Verify element is enabled in Selenium WebDriver
There are menu situations when you want to verify if en Element is enabled or disabled , selenium webdriver allows us to verify element is enabled following a quite simple API
Solution
isEnabled() – is a Selenium WebDriver method which is developed in Web Element class and allows us to check if an element is enabled or disabled on the page. Basically the statement returns a Boolean, (true or false) and we can value the result.
Now submit button will be a true or false and we can use that information in different ways:
Assert element is enabled or disabled:
Perform an action based on isenabled() results:
Selenium is really powerful in its own API and you can pretty much to whatever you want , I would like to quote one of the selenium developers :
Selenium automates browsers. That’s it. What you do with that power is entirely up to you. Primarily it is for automating web applications for testing purposes, but is certainly not limited to just that. Boring web-based administration tasks can (and should!) also be automated as well.
If you are a Ruby capybara user you are not left behind , you can easily check using find_field method :
If you want to return a boolean value you can use Node::Matchers has_field?:
Happy testing!
The post Verify element is enabled in Selenium WebDriver appeared first on Testingrepository - Talking about selenium , and our passion.
This post first appeared on Testing Repository - Creating Testing, please read the originial post: here