Link types
Collect every link on the page, then check which ones respond with an error status.
#linkList aa[href]//a[contains(text(),'Broken')]
- Internal page link (Form inputs) 200
- Same-page anchor link anchor
- External link (opens in a new tab) 200
- Broken link (local 404) 404
- Broken external link 404
- Server error link 500
- Redirect link 301
- Anchor without href no href
- Email link (mailto) mailto
- Link handled by JavaScript js
Use the buttons, or write a test that checks each href.
Images
A broken image has naturalWidth === 0 once loading has finished.
#validImage#brokenImageimg[alt]
