Find all the Links on a Webpage with Selenium WebDriver in Java

Test Automation.

Find all the Links on a Webpage with Selenium WebDriver in Java

3 minutes readKey takeaways findElements with By.tagName("a") returns every anchor, including ones that are not visible. Filter on getAttribute("href") before using them, since many anchors have no destination. For link checking, collect the URLs first and request them outside the browser. Navigating through a webpage and cataloging every single link can be a daunting task, especially if… Read more »