For some reason, puppeteer seems to open two browser windows with this code. One with just one tab and it’s about:blank. The other one starts with about:blank and redirects to the actually goes to the URL specified.
System : Ubuntu 22.04,
Google Chrome for Testing 131.0.6778.87 (Official Build) (64-bit)
const puppeteer = require('puppeteer-extra')
const fs = require('fs');
const cookiesPath = "cookies.txt";
const StealthPlugin = require('puppeteer-extra-plugin-stealth')
const { createCursor } = require("ghost-cursor")
puppeteer.use(StealthPlugin())
...
cookies = JSON.parse(cookies)
let args = []
if(proxy) {
args.push(`--proxy-server=${proxy}`)
}
puppeteer.launch({ headless: false, args: args }).then(async browser => {
const context = await browser.createBrowserContext()
await context.setCookie(...cookies)
let page = await context.newPage()
let finalUserAgent = userAgent || defaultUserAgent
console.log('Attempting to login w existing session..')
await page.setUserAgent(finalUserAgent)
await page.setDefaultNavigationTimeout(100000); // 90 seconds
await page.goto(url)
//await page.waitForTimeout(5000)
//await browser.close()
console.log(`logged in`)
})
console.log(userAgent, proxy);
res.send("browser launched with session");
Any kind of help is much appreciated.