How on Selenium Webdriver to check the presence of an element and, if an element is found, then click on it, and if not, then continue with the program?
Selenium Webdriver
For example:
boolean present; try { driver.findElement(By.id("")); present = true; } catch (NoSuchElementException e) { present = false; }
Or:
if (!driver.findElement(By.id("...")).isEmpty()) { //Click on element } else { //Element was not found }
Source: https://ru.stackoverflow.com/questions/511152/More articles:Does not see the servletIcon fortagWinForms authentication via WCFWhy assigning a readonly value to a property does not cause an error?Algorithm for generating random coordinates in a two-dimensional planeAngularJS how to insert your validity condition?MySQL check for two duplicates when writingCannot select class access modifierThe swap () function to change the elements of an array of structuresCatch deselect the cellAll Articles