Finding the Broken HyperLinks

      No Comments on Finding the Broken HyperLinks


HyperLinks in HTML useful to navigate to another web-page.
HyperLinks are defined using the tag name-a using an attribute name href.
We need to define the Link text between the tag name to get the text displayed on the web-page.
Clicking on the link redirected to a new window or in the same window. This can be defined using an attribute target.

  • target=_self -> opens the web-page in the same window
  • target=_blank -> opens the web-page in a new window

Using Locators in Selenium WebDriver, we can automate the steps to click on the link to navigate to a page defined under the attribute href as defined below:
Link_Text

href =”http://total-qa.com” target=”_blank”
Scenario:

Is there any way to identify the broken links using Selenium WebDriver?

HTTP ERROR CODE : 404

HTTP ERROR CODE : 404


The below logic helps in identifying the broken links.
Currently we are using WebDriverManager to instantiate the Driver Instance.

Conclusion:
Broken links in a web-page are identified using Selenium and Java API.

Leave a Reply

Your email address will not be published. Required fields are marked *