I am testing a simple Puppeteer script to open a bet365 specific page, but when opened with Chrome for Testing, the website does not loads completely and looks like it hides the html that show the matches
let puppeteer = require('puppeteer');
const { addExtra } = require('puppeteer-extra')
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
const stealth = StealthPlugin();
stealth.enabledEvasions.delete('chrome.runtime')
stealth.enabledEvasions.delete('iframe.contentWindow')
puppeteer = addExtra(puppeteer)
const pluginStealth = StealthPlugin()
pluginStealth.enabledEvasions.delete('console.debug')
puppeteer.use(pluginStealth)
const VIEWPORT = {width: 1200, height: 900};
const BET365 = 'https://www.bet365.com/#/AVR/B146/R^1/';
(async () => {
const browser = await puppeteer.launch({
headless: false,
args: [
"--disable-infobars",
"--no-sandbox",
"--disable-blink-features=AutomationControlled",
"--incognito"
],
ignoreDefaultArgs: ["--enable-automation"],
});
const page = await browser.newPage()
await page.evaluateOnNewDocument(() => {
window.chrome = { runtime: {} };
delete navigator.__proto__.webdriver;
Object.defineProperty(navigator, 'maxTouchPoints', {
get() {
return 1;
},
});
navigator.permissions.query = i => ({then: f => f({state: "prompt", onchange: null})});
});
page.viewport(VIEWPORT);
await page.setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3.1 Safari/605.1.15');
const client = await page.target().createCDPSession()
await client.send('Network.clearBrowserCookies')
await page.goto(BET365, { waitUntil: 'networkidle2' });
})()
But it works normal if i open the link in a regular browser Does somebody know how can i bypass it?
