See here for a workaround if you're affected by this: https://github.com/berstend/puppeteer-extra/issues/399#issuecomment-759387597
and another workaround: https://github.com/berstend/puppeteer-extra/issues/399#issuecomment-770155239
Describe the bug
Code Snippet
const fs = require('fs')
const json = require('JSON')
const puppeteer = require('puppeteer-extra')
const { Bot } = require('tgapi')
const mysql = require('mysql')
const StealthPlugin = require('puppeteer-extra-plugin-stealth')
var dbConfig ={
host : 'localhost',
port : '3307',
user : 'xxxx',
password : 'xxxx',
database : 'mydb'
}
let connection = mysql.createPool(dbConfig);
connection.setMaxListeners(20)
puppeteer.use(StealthPlugin())
//Ejecucion de Puppeteer
puppeteer.launch({ args: ['--start-maximized'], headless: false }).then(async browser => {
console.log('Ejecutando script...')
const page = await browser.newPage()
await page.goto('https://www.bet365.es/#/IP/B1');
etc...
Versions
System:
OS: Windows 10 10.0.18363
CPU: (8) x64 Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
Memory: 8.31 GB / 15.86 GB
Binaries:
Node: 12.17.0 - C:\Program Files\nodejs\node.EXE
npm: 6.14.10 - ~\AppData\Roaming\npm\npm.CMD


I observe the same thing. There is such an error in the console
Same thing here ... can't load bet365.com
Which Chrome version are you using?
Chromium the one which is installed alongside puppeteer.
Which Chrome version are you using?
Chromium Versi贸n 88.0.4298.0
Also i downgraded to 86.0.4240.0 but still is not working
Removing stealth plugin and adding '--disable-blink-features=AutomationControlled' its working again
Thanks @apulidoc, its working.
The bet365 site has very strict IP checks. If you open the site with an:
Some more observations:
./node_modules/puppeteer/.local-chromium/mac-818858/chrome-mac/Chromium.app/Contents/MacOS/Chromium https://www.bet365.com/ --no-first-run --user-data-dir=$(mktemp)
--remote-debugging-port=9992) with puppeteer.connect({browserURL: 'http://localhost:9992'}): it's again stuck on loading the site. This means they detect something in the way the page is opened.const puppeteer = require('puppeteer-extra')
puppeteer.use(require('puppeteer-extra-plugin-stealth')())
puppeteer.launch({ headless: false }).then(async browser => {
const page = (await browser.pages())[0];
await page.goto('https://www.bet365.com/');
});
We need to investigate what they detect exactly in newly opened pages.
We need to investigate what they detect exactly in newly opened pages.
My immediate thoughts is it must be one of the evasions leaking / mismatching if it's occurring only on newPage() and passing on bundled Chromium?
(ie something is out of alignment with real-Chrome)?
I'm in favor of deleting those evasions, since they do more wrong than good. I think @berstend was already planning to remove them in automation-extra, but it might be a good idea to also remove them in the existing code.
Seems like the issue it was targeting was solved in recent releases of pptr or it was fixed in chrome itself.. If the TS says it broke 2 days ago
Do you have any link to that?
I think we might be confusing different issues here:
https://github.com/puppeteer/puppeteer/issues/1106
iframe.contentWindow to existhttps://github.com/puppeteer/puppeteer/issues/3667
Workaround for the time being:
const stealth = StealthPlugin();
stealth.enabledEvasions.delete('chrome.runtime')
stealth.enabledEvasions.delete('iframe.contentWindow')
puppeteer.use(stealth);
I confirmed through local testing that the bug with iframes is still present. There's potential to improve the iframe.contentWindow evasion though, so it doesn't break e.g. bet356
@berstend As your code is based on puppeteer, if I want to use Selenium, what is the equivalent of stealth.enabledEvasions.delete in Selenium?
@berstend As your code is based on puppeteer, if I want to use Selenium, what is the equivalent of
stealth.enabledEvasions.deletein Selenium?
Selenium is not supported by us - stealth.enabledEvasions is a Map() which is used by the stealth plugin (.delete is just a native method of Maps). This won't help you as the puppeteer-extra as well as the stealth plugin are not written to support selenium. :-)
Closing for now, as iframe.contentWindow issues are quite well known by now and a workaround is mentioned above. Eventually we improve the evasion so it doesn't cause as much breakage.
It seems like Bet365 has improved its detection method, and now the workaround doesn't work.
Example of use:
const puppeteer = require('puppeteer-extra')
const StealthPlugin = require('puppeteer-extra-plugin-stealth')
const stealth = StealthPlugin();
stealth.enabledEvasions.delete('chrome.runtime')
stealth.enabledEvasions.delete('iframe.contentWindow')
puppeteer.use(stealth);
puppeteer.launch({ args: ['--no-sandbox','--start-maximized'], headless: false }).then(async browser => {
const page = await browser.newPage()
await page.goto('https://www.bet365.com/');
await page.waitFor(50_000)
})
@berstend maybe we should reopen the issue?
Yup, bet365 broke puppeteer again :(
Yes! It has stopped just today for me. Does anyone has a new workaround to solve it?
if anyone find a solution please post here! =)
Hello friends,
Here I've created a temporary fix for bet365
Run this and it should work
await page.evaluateOnNewDocument(() => {
Object.defineProperty(navigator, 'maxTouchPoints', {
get() {
return 1;
},
});
});
Will take a closer look on free time
Do you have the complete code that you're using? I'm using the code below and it's not working.
const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
puppeteer.use(StealthPlugin());
puppeteer.launch({ executablePath: '/usr/bin/chromium-browser', headless: true, args: ['--no-sandbox', '--disable-blink-features=AutomationControlled'] }).then(async browser => {
console.log('Running tests..');
const page = await browser.newPage();
await page.goto('https://bet365.com');
await page.evaluateOnNewDocument(() => {
Object.defineProperty(navigator, 'maxTouchPoints', {
get() {
return 1;
},
});
});
await page.screenshot({ path: 'bet365.png', fullPage: true });
await browser.close();
console.log('All done, check the screenshot.');
});

Do you have the complete code that you're using? I'm using the code below and it's not working.
const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
puppeteer.use(StealthPlugin());
puppeteer.launch({ executablePath: '/usr/bin/chromium-browser', headless: true, args: ['--no-sandbox', '--disable-blink-features=AutomationControlled'] }).then(async browser => {
console.log('Running tests..');
const page = await browser.newPage();await page.goto('https://bet365.com'); await page.evaluateOnNewDocument(() => { Object.defineProperty(navigator, 'maxTouchPoints', { get() { return 1; }, }); }); await page.screenshot({ path: 'bet365.png', fullPage: true }); await browser.close(); console.log('All done, check the screenshot.');});
Do not forget the rest stuff
const stealth = StealthPlugin();
stealth.enabledEvasions.delete('chrome.runtime')
stealth.enabledEvasions.delete('iframe.contentWindow')
puppeteer.use(stealth);
It鈥檚 not working for me. Can you share the code you鈥檙e using, please?
const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
const stealth = StealthPlugin();
stealth.enabledEvasions.delete('chrome.runtime')
stealth.enabledEvasions.delete('iframe.contentWindow')
puppeteer.use(stealth);
puppeteer.launch({ executablePath: '/usr/bin/chromium-browser', headless: true, args: ['--no-sandbox', '--disable-blink-features=AutomationControlled'] }).then(async browser => {
console.log('Running tests..');
const page = await browser.newPage();
await page.goto('https://bet365.com');
await page.evaluateOnNewDocument(() => {
Object.defineProperty(navigator, 'maxTouchPoints', {
get() {
return 1;
},
});
});
await page.screenshot({ path: 'bet365.png', fullPage: true });
await browser.close();
console.log('All done, check the screenshot.');
});
It鈥檚 not working for me. Can you share the code you鈥檙e using, please?
const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
const stealth = StealthPlugin();
stealth.enabledEvasions.delete('chrome.runtime')
stealth.enabledEvasions.delete('iframe.contentWindow')
puppeteer.use(stealth);puppeteer.launch({ executablePath: '/usr/bin/chromium-browser', headless: true, args: ['--no-sandbox', '--disable-blink-features=AutomationControlled'] }).then(async browser => {
console.log('Running tests..'); const page = await browser.newPage(); await page.goto('https://bet365.com'); await page.evaluateOnNewDocument(() => { Object.defineProperty(navigator, 'maxTouchPoints', { get() { return 1; }, }); }); await page.screenshot({ path: 'bet365.png', fullPage: true }); await browser.close(); console.log('All done, check the screenshot.');});
You need to run await page.evaluateOnNewDocument(() => { before await page.goto('https://bet365.com');
Im having troubles with this workaround...
When I try to make an a evaluate with queryselector or queryselectorall the pages freeze automatically and chromium begin to leak memory as fuck. I cant use the console webbrowser, i cant retrieve any data from the website...
Anyone has this trouble?
Most helpful comment
Removing stealth plugin and adding '--disable-blink-features=AutomationControlled' its working again