Finding objects/elements on web page using Selenium RC and Webdriver

Selenium has API’s to get the element ID’s of the web page like Selenium.GetAllButtons();
Selenium.GetAllFields(); and more.
If you use the WebDriver than you can use the following code:

protected List findElements(By by) {
if (!(driver.findElements(by).isEmpty())){
log.info("elements " + by + " are found");
return driver.findElements(by);
}else{
log.warn("elements " + by + " are not found");
return driver.findElements(by);
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *