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 *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>