Find out broken links / images on website using webDriver
Broker Links: By just seeing the Links in the UI, we may not be able to confirm if that link is working or not until we click and verify it. To achieve this, we can use HttpClient library to check status codes of the URLs on a page. If request was NOT processed correctly, then the HTTP status codes may not return 200 status code. We can easily say whether the link is broken or not with status codes. Now let us jump into the example, First we will try to find all anchor tags on the page by using Webdriver. By using the below syntax: We need to iterate through each link and verify request response Status codes and it should be 200 if not, we will increment invalid links count Let us look into the example : package com.linked; import java.util.List; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.HttpClientBuilder; import org.op...