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



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

Answer / नितिन

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

More Selenium Interview Questions

What is the object repository?

0 Answers  


How would one access the value of a side variable named name from within a javascript snippet used as the argument to a selenese command?

0 Answers  


What is the difference between page object model (pom) and page factory?

0 Answers  


What is the command line we have to write inside a .bat file to execute a selenium project when we are using testng?

0 Answers  


How can we find all the links on a web page?

0 Answers  






How to install use TestNG in selenium webdriver ?

0 Answers   Infosys,


Difference between get window handle & get window handles

1 Answers  


What is the purpose of creating a reference variable- 'driver' of type webdriver instead of directly creating a firefoxdriver object or any other driver's reference in the statement webdriver driver = new firefoxdriver();?

0 Answers  


What is desired capability? How is it useful in terms of selenium?

0 Answers  


When to use autoit?

0 Answers  


What are the advantages of selenium webdriver?

0 Answers  


what are the Dynamic elements in web Application?

2 Answers   Eton, HCL,


Categories