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

[Bug] Puppeteer fails to find selector on headless mode #27

Open
gruberdev opened this issue Sep 29, 2023 · 0 comments
Open

[Bug] Puppeteer fails to find selector on headless mode #27

gruberdev opened this issue Sep 29, 2023 · 0 comments

Comments

@gruberdev
Copy link

gruberdev commented Sep 29, 2023

Running the itauscraper script results in a failure at the login step. Puppeteer is unable to locate the selector #agencia, throwing an Error: No node found for selector: #agencia.

Environment:

  • Node.js version: v18.17.1
  • Project version: v1.4.2

Steps to Reproduce:

  1. Clone the repository and navigate to the project directory.
  2. Install dependencies via npm install or yarn install.
  3. Run the script

Observe the error:

/home/deck/Projects/itauscraper/node_modules/puppeteer/lib/cjs/puppeteer/common/assert.js:26
        throw new Error(message);
              ^

Error: No node found for selector: #agencia
    at assert (/home/deck/Projects/itauscraper/node_modules/puppeteer/lib/cjs/puppeteer/common/assert.js:26:15)
    at DOMWorld.type (/home/deck/Projects/itauscraper/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:315:32)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async stepLogin (/home/deck/Projects/itauscraper/itauscraper.js:16:3)
    at async scraper (/home/deck/Projects/itauscraper/itauscraper.js:199:3)

Additional information

  • Running on non-headless mode, it works as expected. This might be due to Itaú checking for automated tools like Pupeteer, and it seems an user-agent can be used to fix this error.
@gruberdev gruberdev changed the title Puppeteer fails to find selector on headless mode [Bug] Puppeteer fails to find selector on headless mode Sep 29, 2023
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

1 participant