Early on in my testing career, I would test all of the content in the Content Management System (CMS) I was working with. This included external links that were pointed to other websites outside of the company I worked for. This worked fine for a while, especially on pages that were recently updated. However, this would change when I implemented random page testing. I started to have tests failing from dead links taking forever to load. This turned my consistent tests into brittle tests that were at the whims of our content editors. At the time, I was a team of one person (minus my manager). I had no idea what to do to solve this issue, but I knew I had to come up with a plan.
I spent a weekend pondering the idea. The thing that kept annoying me was that I was testing someone else’s content, with no easy way to avoid the hidden landmines that were dead links. I had started coding in HTTP calls to check if a link was a 404 or another error code, when it finally hit me. I don’t need to actually click the link to ensure it loads properly, I can just do an HTTP call and ensure the correct HTML elements were in place so the link opens in a new tab! I shared the idea to my manager and our Project Owner, and they both liked the idea. With their approvals on my side, I immediately got it implemented.
All the implementation was fairly simple: I verified that a link was external if the base URL did not match the website’s URL, ensured that said link also included target='_blank' and rel='noreferrer noopener' (preferably both) on their tag attributes so the link opens in a new tab, and lastly performing an HTTP call to check if the site was a 200 or some kind of error link. This not only solved test flakiness, but also sped testings up.
Flash forward years later, and this is still something I do. It was even a part of a conference talk I did back in 2025. I shared this concept to a crowd of QA testers because this is an idea that I do believe all testers should adopt to. It’s what I wish I was told when I was just a newbie at QA trying to solve this issue. To summarize, avoid click interactions external link on the project you are working. Use HTML attributes to ensure an external link will open in a new tab, and use a simple HTTP call to see if the link is dead. It will save you from constant debugging and saves time in testing.