Home » Selenium C# Scripts » How to handle if .Displayed and .Enabled in selenium does not work

How to handle if .Displayed and .Enabled in selenium does not work

driver.findElement(By.Id("YourIdHere")).Displayed. There are more chances that, this line of code might return null and throw NoSuchElementFound exception when it doesn't find 
particular element on the webpage. To handle it, you need to create a simple method which return boolean value and enclose above line of code by try and catch.

2 Comments

Leave a comment

Your email address will not be published. Required fields are marked *