Selenium code snippets : how to find all anchor links on the page

Posted in Selenium By Raj On October 25, 2017

 

In this article, I am going to explain to you how to find all anchor links on the page, I am using find element by tag name locator to find  out all anchor elements

We are going to fetch all elements which the tag name equals to HTML element anchor tag, something like below, it returns a list of anchor links so, we must use List collection, once we have a list of links iterate it using for loop and print on the console

Code :

Output :

selenium-anchor-locator