Open lcosmos opened 2 years ago
Do you have any sample code to reproduce this issue?
Have you solved the problem? I have the same issue with the following code:
import { setTimeout as sleep } from 'timers/promises';
import UserAgent from 'user-agents';
import puppeteer from 'puppeteer-extra';
import StealthPlugin from 'puppeteer-extra-plugin-stealth';
import { createCursor } from 'ghost-cursor';
const userAgent = new UserAgent({ deviceCategory: 'desktop' }).toString();
const browser = await puppeteer.use(StealthPlugin()).launch({
headless: false,
ignoreHTTPSErrors: true,
args: [
'--disable-gpu',
'--disable-extensions',
'--disable-dev-shm-usage',
'--no-sandbox',
'--disable-setuid-sandbox',
'--no-first-run',
'--no-zygote',
'--single-process',
'--disable-infobars',
'--window-position=0,0',
'--ignore-certifcate-errors',
'--ignore-certifcate-errors-spki-list',
'--lang=zh-CN,zh,en,en-US',
],
});
let page = await browser.newPage();
const cursor = createCursor(page);
await page.setUserAgent(userAgent);
await page.setRequestInterception(true);
await page._client.send('Network.setCacheDisabled', {
cacheDisabled: false,
});
page.on('request', async (request) => {
const url = request.url();
if (['image', 'media', 'stylesheet', 'font'].includes(request.resourceType())) {
request.abort();
} else {
console.log(url, request.resourceType());
request.continue();
}
});
await page.goto('https://www.hermes.cn');
const iFrame = await page.waitForSelector('iframe[src^="https://geo.captcha-delivery.com"]');
const frame = await iFrame.contentFrame();
const clickHandle = await frame.waitForSelector('.geetest_radar_tip');
await cursor.click(clickHandle);
await sleep(30000);
Version: 1.1.8
Falling back to JS scroll method ProtocolError: Protocol error (DOM.scrollIntoViewIfNeeded): Node does not have a layout object at /Users/xxx/Project/new-ali/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:230:24 at new Promise ()
at CDPSession.send (/Users/xxx/Project/new-ali/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:226:16)
at next (/Users/xxx/Project/new-ali/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/index.js:32:41)
at CDPSession.send (/Users/xxx/Project/new-ali/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/index.js:57:18)
at Object. (/Users/xxx/Project/new-ali/node_modules/ghost-cursor/lib/spoof.js:426:53)
at step (/Users/xxx/Project/new-ali/node_modules/ghost-cursor/lib/spoof.js:44:23)
at Object.next (/Users/xxx/Project/new-ali/node_modules/ghost-cursor/lib/spoof.js:25:53)
at fulfilled (/Users/xxx/Project/new-ali/node_modules/ghost-cursor/lib/spoof.js:16:58) {
originalMessage: 'Node does not have a layout object'
}