Open KaiSeR1205 opened 1 month ago
async function pageController({ browser, page, proxy, turnstile, xvfbsession, pid, plugins, killProcess = false, chrome }) {
let solveStatus = turnstile
console.log(typeof page)
page.on('close', () => {
solveStatus = false
});
browser.on('disconnected', async () => {
solveStatus = false
if (killProcess === true) {
if (xvfbsession) try { xvfbsession.stopSync() } catch (err) { }
if (chrome) try { chrome.kill() } catch (err) { console.log(err); }
if (pid) try { kill(pid, 'SIGKILL', () => { }) } catch (err) { }
}
});
async function turnstileSolver() {
while (solveStatus) {
await checkTurnstile({ page }).catch(() => { });
await new Promise(r => setTimeout(r, 1000));
}
return
}
turnstileSolver()
if (proxy.username && proxy.password) await page.authenticate({ username: proxy.username, password: proxy.password });
if (plugins.length > 0) {
for (const plugin of plugins) {
plugin.onPageCreated(page)
}
}
await page.evaluateOnNewDocument(() => {
Object.defineProperty(MouseEvent.prototype, 'screenX', {
get: function () {
return this.clientX + window.screenX;
}
});
Object.defineProperty(MouseEvent.prototype, 'screenY', {
get: function () {
return this.clientY + window.screenY;
}
});
});
const cursor = createCursor(page);
page.realCursor = cursor
page.realClick = cursor.click
return page
}
here console.log(typeof page) page.on('close', () => { solveStatus = false }); page undefined
Description
linux centos Chromium version 126.0.6478.114 start server run error : Cannot read properties of undefined (reading 'on')
Full steps to reproduce the issue
Issue Type
Support
Operating System
Linux
Do you use Docker?
None