Tuesday, January 7, 2014

Check If An Element Exists

Check If An Element Exists

You may need to perform a action based on a specific web element being present on the web page. You can use below code snippet to check if a element with id “element-id” exists on web page. 


driver.findElements(By.id("element-id")).size()!=0

No comments:

Post a Comment