Hello all I am using webdriver so if I want to use selenium;s rc function isElementPresent I have to emulate selenium rc so I do something like this:
import org.
Sometimes the element you are trying to find is loading, s0 will throw an exception using
findElement(By.xpath(xpathLocator))
Therefore we would need do what Dejan Veternik has recommended, it will help wait until the ELEMENT has been loaded in the webpage, I am passing Selenium and extracting webdriver, this is helpful incase you are using WebDriverBackedSelenium just like me ...
private boolean isElementPresent(WebDriverBackedSelenium driver, String id) {
try {
driver.getWrappedDriver().findElement(By.id(id));
return true;
} catch (Exception e) {
return false;
}
}