While scraping or testing websites, sometimes it’s convenient to open a link (e.g., via “control-click”) on a page into a new browser tab, do some work in the new tab, and close it. This avoids the hassle of using breadcrumbs or the Back button. This approach can also result in less work for the website’s backend since closing tabs doesn’t normally request remote data.
Here’s how to automate “control-clicking” a link in Chromium, in order for the link’s contents to appear in a new tab. This example uses CodeceptJS and Puppeteer. This solution has been tested on OSX and Ubuntu. It should work on Windows.
First, create a helper for CodeceptJS and alter CodeceptJS’s configuration to use it:
Then use this in your scenario: