Quality Testing

Quality is delighting customers

How to verify a disabled button showing on a page or not?

How to verify a disabled button showing on a page or not using Selenium WebDriver?

Views: 154

Reply to This

Replies to This Discussion

Assuming I am understanding your question correctly (I apologize if I am not), if you are using Selenium, and you are trying to verify that the button is disabled/enabled, there is a built in property for this. Here is an example of how that assertion would look using Selenium in C#:


Assert.IsFalse(driver.FindElementByName("Submit").Enabled);

If you are simply trying to verify of the button is present on the page, there is also a built in property for that. Here is an example of how that assertion would look using Selenium in C#:

Assert.IsTrue(driver.FindElementByName("Submit").Displayed);

Hi,

If you are using Selenium WebDriver , java (common combination being used in most of the automation and qa services companies), you can use the following:

WebElement we = driver.findElementById("Disabled Element Id");
boolean actualValue = we.isEnabled();
Assert.assertEquals(False , actualValue);

Hope it helps.

Thanks,
Anand

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2019   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service