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 does a concentrator do in the selenium network?

516


How to read a javascript variable in selenium webdriver?

524


What is selenium-rc (remote control) ?

548


What are the annotations available in testng?

501


Tell us what kinds of test types are supported by selenium?

489






What are the steps to run automation using selenium?

529


Write a code to wait for a particular element to be visible on a page. Write a code to wait for an alert to appear.

766


Explain how you can handle colors in web driver?

588


what is mutation testing, Difference between system and End to End testing,Give examples of bug having high priority but low severity except spelling mistakes and logo symbol.

1504


Explain what are the junits annotation linked with selenium?

495


What are the important selenium ide commands or selenese commands?

508


What do we mean by selenium 1 and selenium 2?

510


What’s new in selenium 3.0?

511


What are the different ways in which selenium ide can be opened?

463


What are the prerequisites to run selenium webdriver?

526