Selenium capture webpage errors by url verification.
Step 1: We need to open a web page and fetch all elements having href attribute.
Step 2: As there are more than 500 links in those pages, it takes very long to check all URL’s. So basic multi-threading works very well. So we create 30 thread to fetch all URL’s.
Step 3: Our threads have the basic implementation of HTTPClient and make a GET request to URLs.
Step 4: In case of HTTP response is other than 200, we add this URL to a list to be able to report them after the test execution.
Step 5: After all the links are controlled, we check our error list. In case the list is not empty, we fail with an assertion.