As soon as you need to control anything, you have to use [Puppeteer](https://developers.google.com/web/tools/puppeteer/)