// This is the official Selenium documention endorsed method of waiting for elements. // This method is ineffective because it still suffers from // the stale element exception. public static void clickByLocator ( final By locator ) { WebElement myDynamicElement = ( new WebDriverWait(driver, 10)) .until( ExpectedConditions.presenceOfElementLocated( locator ) ); myDynamicElement.click(); }