How to click on all links in a page using selenium webdriver?
Answers
Answered by
4
List allLinks = driver.findElements(By.tagName("a"));
System.out.println("All links found on web page are: " + allLinks.size() + " links");
for (WebElement link : allLinks) {
//print the links i.e. http://example.com or https://www.example.com. ...
//print the links text.
System.out.println(link.getText());
System.out.println("All links found on web page are: " + allLinks.size() + " links");
for (WebElement link : allLinks) {
//print the links i.e. http://example.com or https://www.example.com. ...
//print the links text.
System.out.println(link.getText());
Answered by
2
¶ Capture all links under specific frame|class|id and Navigate one by one.
¶ Capture all links [Alternate method]
Hope Helps ♥️
¶ Capture all links [Alternate method]
Hope Helps ♥️
Similar questions