Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node does not have a layout object #45

Open
lcosmos opened this issue Feb 13, 2022 · 2 comments
Open

Node does not have a layout object #45

lcosmos opened this issue Feb 13, 2022 · 2 comments

Comments

@lcosmos
Copy link

lcosmos commented Feb 13, 2022

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'
}

@Niek
Copy link
Collaborator

Niek commented Feb 14, 2022

Do you have any sample code to reproduce this issue?

@dzcpy
Copy link

dzcpy commented Jun 9, 2022

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants