selenium - Webdriver - How can I Assert an attribute exists -
selenium - Webdriver - How can I Assert an attribute exists -
i'm trying assert particular "id" contains attribute of "hidden". "hidden" attribute never have value. exist if have clicked on particular button , not exist if haven't clicked on particular button. here code:
<div id="callback-time" hidden="">
i have tried handle on attribute follows i'm not getting anything:
iwebelement callbacktime = driver.findelement(by.id("callback-time"); string value = callbacktime.getattribute("hidden"); system.diagnostics.debug.writeline(value);
the 2 conditions check are:
button not clicked , attribute not exist<div id="callback-time">
button clicked , attribute exist <div id="callback-time" hidden="">
you can extract html element string , basic substring check tell difference
iwebelement callbacktime = driver.findelement(by.id("callback-time"); string value = callbacktime.getattribute("innerhtml"); assert.areequal(value.contains("hidden=\"\""), true);
selenium selenium-webdriver webdriver
Comments
Post a Comment