Puppeteer Won't Click on Element
See original GitHub issueTrying to get Puppeteer to navigate through my login page which will bring the automated test to the main page of my site. It all works until it reaches ‘waitFor(’#idSIButton9’);'. Puppeteer successfully enters the password and username but can’t seem to select the submit button(#idSIButton9). Any idea what might be going wrong here? Let me know if you guys need more info. Thanks 😃
const puppeteer = require('puppeteer');
const { defineSupportCode } = require('cucumber')
defineSupportCode(({ Before, Given, When, Then }) => {
Before({ timeout: 60 * 1000 }, async function testCase() {
this.browser = await puppeteer.launch({ headless: false });
this.page = await this.browser.newPage();
await this.page.setViewport({width: 1024, height: 768});
await this.page.goto('http://localhost:3000', {waitUntil: 'networkidle2'});
await this.page.screenshot({ path: 'test_artifacts/img/load.png', fullPage: true });
await this.page.waitFor('button');
await this.page.click('button');
await this.page.waitFor('#i0116');
await this.page.type('#i0116', 'username');
await this.page.waitFor('#i0118');
await this.page.type('#i0118', 'password');
await this.page.waitFor('#idSIButton9');
await this.page.click('#idSIButton9');
})
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:39 (2 by maintainers)
Top Results From Across the Web
puppeteer element.click() not working and not throwing an error
The problem is that because the view (div) is animating the element's boundingBox() is changing, and between the time of asking for the...
Read more >7 solutions for page.click() is not working in puppeteer
1. Focus and Enter - First Focus on the element and then press enter. · 2. using $eval - you can try as...
Read more >Page.click() method - Puppeteer
This method fetches an element with selector , scrolls it into view if needed, and then uses Page.mouse to click in the center...
Read more >Error - Click not executed | Checkly
Not-so-obvious: the element we are trying to click is on the page, but is not the one receiving the click; there might be...
Read more >How to Click on Element with Puppeteer and Chrome
How to Click on Element with Puppeteer and Chrome · button left, right, or middle, defaults to left. · clickCount defaults to 1....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Try to set a time before clicking…
In my case, I’m able to use this reliably:
page.$eval(selectorStr, elem => elem.click());