javascriptpuppeteerwebautomationplaywright

how to focus current tab puppeteer


How do I focus on the newly opened tab in puppeteer? I click an element on the page that opens up a new tab and then puppeteer stays focused on the page that was just left for some reason. How can I focus on the newly opened tab? I'm using google chrome browser


Solution

  • You can use the bringToFront function.

    await page.bringToFront();