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
What is difference between @factory and @dataprovider annotation?
Is there a way to refresh browser using selenium?
Tell me how can we launch different browsers in selenium webdriver?
What you say in regards to the flexibility of selenium test suite?
What is the difference between verification and assertion?
How to check whether a text is underlined or not?
What are the types of webdriver apis available in selenium?
Explain the difference between assert and verify commands?
How to click on a hyper link using linktext?
What is the difference between selenium and sikuli?
What is the command line we have to write inside a .bat file to execute a selenium project when we are using testng?
Tell us what are the two modes of views in selenium ide?
What do we mean by selenium 1 and selenium 2?
What is the difference between “/” and “XPath //”?
How can we find all the links on a web page?