When running puppeteer(last version from npm - 0.13.0) and passing args to
puppeteer.launch({ headless: false })
the chrome is opened with an empty page as a first tab and opens the actual page from the script in the second tab.
const page = await browser.newPage();
Is it an expected behavior? Or a bug?
Yes that's expected behavior. It works exactly as opening a chrome browser. If you closed that first tab the browser will close just as using the chrome browser. There needs to be at least one tab open for the browser to remain open. If you use await browser.pages()
upon launching the browser, that will return all the pages open currently, which should be 1 about:blank
page.
The solution is to use the existing tab/page (dont open a new one):
// launch the browser var browser = await puppeteer.launch({ headless: false }); // get existing tab/page (first item in the array) var [page] = await browser.pages(); // load barcode tracking website await page.goto('https://orcascan.com');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With