java - WebElement Visible and sometimes not Visible -
the element become visible , not become visible. element not in dom. how handle situation using selenium webdriver?
1st can wait element visible on dom
webdriverwait wait = new webdriverwait(driver, 15); wait.until(expectedconditions.visibilityofelementlocated("your locator")));
you can check if element present on dom or not. use below code same
if (driver.findelements("your locator").size() != 0) { driver.findelement(your locator).click(); system.out.println("element exists"); } else{ system.out.println("element not exists"); }
hope :)
Comments
Post a Comment