Search code examples
seleniummachine-learningcypresswebdriver-io

How to create test suite for any broken images using machine learning based algoritham/ AI based Automation


I am working on a sizeable large eCommerce web-portal where, there are many images on thousands of CMS generated dynamic pages. The location of the image on page is fixed.

How to create a Javascript / Machine Learning based test automation bot, which will skim through all of these pages & result in the pages where images do not load.

Time for this test run is not a constraint, as we won't be putting this run as CI/CD pipeline, rater a standard overnight run.


Solution

  • 1 Start by fetching a page (load it in a browser, or make a HTTP request for it, depending if you need to wait for JS or not) 2 Find all tags, and store each one in a Set of toVisitPages 3 Find all tags on current page 4 For each tag on current page, make a HTTP request to it, does it 404? If so - add it to your broken list 5 Start at step 2) with the next page from toVisitPages