Created
January 22, 2016 20:58
-
-
Save sayems/9c8b80aa8826f1adcd28 to your computer and use it in GitHub Desktop.
How To Test For Disabled Elements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| driver.get("http://the-internet.herokuapp.com"); | |
| driver.findElement(By.linkText("Dropdown")).click(); | |
| List<WebElement> dropdown=driver.findElements(By.xpath("//select[@id='dropdown']/option")); | |
| for (int i = 0; i < dropdown.size(); i++) { | |
| if(dropdown.get(i).getText()=="Please select an option") | |
| { | |
| //assert false will always expects false value. | |
| //Here option is disabled so it will return false | |
| Assert.assertFalse(dropdown.get(i).isEnabled()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment