Friday, November 1, 2019

How do you identify broken links in Selenium Automation?

When we are asked to identify the broken links in the application, what we do? Collecting all the links on the page to a list and looping through links, clicking on links one by one and verify whether the content on the next page displayed or not?

This process is time consuming, and not that effective as it involves multiple to and fro actions. We can identify the broken links without clicking on the each link using Rest-assured (Java API Library). If you wish to know more about rest-assured click this link. Lets jump into coding part.

Search for "rest-assured maven dependency" in Google. Then copy the latest version of rest-assured dependency of "" as shown in the below screenshot. Add it to your pom.xml file.

In Rest-assured, we have a Http method called "GET", this method is used for retrieving the information from the server. If the link is not broken the server sends response with status code 200 (OK), if the link is broken we receive it sends the status code 404 (Not Found). We use the same logic in our test case.

As shown in the above program, we get the status code of each link and we verify whether it is equal to 200 or not. If not 200, we the link is considered as broken link.

Check the result in the screenshot below

This is how we can identify the broken links using Rest-assured easily.

#HappyTesting #HappyLeaarning #qababu


  1. It would not be fair if we compliment all the blog writings but not the author.
    Automation testing

  2. Glad to chat your blog, I seem to be forward to more reliable articles and I think we all wish to thank so many good articles, blog to share with us. hire automation professional

  3. This is one of the best content for this topic and this is very useful for me. Thank you!
    Unix Training in Chennai
    Linux Training in Chennai
    Linux Course in Chennai

  4. I read this article. I think You put a lot of effort to create this article. I appreciate your work. this page


DevOps 01: What is DevOps and How it benefits organizations?

DevOps is a culture in an organization, where the development team and operations team help each other by sharing information, process and t...