Selenium: WebDriver check if element exists

Trabla: Selenium: WebDriver check if element exists

Solving: 

if ( !driver.findElements( By.className("myclass")).isEmpty()  ){

     //DO SOME STAFF WITH ELEMENT

}else{ 

    //DO SOMETHING ELSE,  ELEMENT NOT FOUND

}

Stackoverflow disscussion:
http://stackoverflow.com/questions/6521270/webdriver-check-if-an-element-exists

No comments:

Post a Comment