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

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -