How does you identify the list of links present on the page

Answer Posted / नितिन

WebDriver driver = new FirefoxDriver();

driver.get("http://toolsqa.wpengine.com/");

java.util.List<WebElement> links = driver.findElements(By.tagName("a"));

System.out.println(links.size());

for (int i = 1; i<=links.size(); i=i+1)

{

System.out.println(links.get(i).getText());

}

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the junits annotation linked with selenium?

556


What are the advantages of the automation structure?

685


Where to obtain selenium ?

598


How to scroll web page down or up using selenium webdriver?

572


how to handle staleelementreferenceexception?

593






Explain what are the junits annotation linked with selenium?

578


Why to use testng with selenium rc?

605


How to check if a button is enabled on the page?

596


How do you identify an object using selenium?

596


How many types of waits in selenium?

551


How to insert a start point in selenium ide?

581


My application uses ajax heavily how do I use selenium rc to work with ajax operations?

590


What are the limitations of using selenium as a test tool?

567


Can captcha be automated?

645


Explain what is the difference between borland silk and selenium?

589