question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot click button of type "submit"

See original GitHub issue

Steps to reproduce

Ubuntu 18.04 Puppeteer 2.0.0

  • Puppeteer version: 2.0.0
  • Platform / OS version: Ubuntu 18.04
  • URLs (if applicable):
  • Node.js version: 10.15.3

What steps will reproduce the problem?

I tried these combinations of code I gathered from this repo’s issues/stackoverflow/other various forums to “click” a button of type submit:

await page.$eval('button[type="submit"]', elem => elem.click());

    await page.click('button[submit]');
    await page.click('button[type=submit]', {waitUntil: 'domcontentloaded'});
    await page.evaluate((selector) => document.querySelector(selector).click(), process.hcPlatform.selectors.signup.submit); 
    await page.evaluate((selector) => document.querySelector(selector).click(), 'button.sc-gisBJw gVJias btn btn-default'); 

    await page.evaluate(() => document.querySelector('button[type="submit"]').scrollIntoView());
    await page.click('button[type="submit"]');

    await page.waitFor('button[type="submit"]');
    await page.$eval('button[type="submit"]', elem => elem.click());
    await page.click('button[type="submit"]', {waitUntil: 'domcontentloaded'});

    await page.waitFor(3000);
    await page.click('button[text="Sign Up"]')

    await page.focus('button[type="submit"]' )
    await page.keyboard.type('\n');

    await page.$$eval('button[type="submit"]', button => {
        button.click();
    });

What is the expected result?

Submit the form

What happens instead?

Either the checkbox above the submit button is DESELECTED and the submit button is ignored, or the submit button is simply ignored, or “no node is found”.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:9

github_iconTop GitHub Comments

1reaction
mmusilcommented, Apr 9, 2020

Got the same problem. Just in my case, I’ve also tried to use this code:

const loginButton = await page.$('button[type="submit"]');
if (loginButton) {
      await Promise.all([page.waitForNavigation(), loginButton.click()]);
}
0reactions
stale[bot]commented, Jul 24, 2022

We are closing this issue. If the issue still persists in the latest version of Puppeteer, please reopen the issue and update the description. We will try our best to accomodate it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Submit button doesn't work - Stack Overflow
You need to ensure you have the submit button within the form element and an appropriate action attribute on the form element is...
Read more >
Cannot click the submit button on the form - Jotform
I think there is a problem on the current embedded iframe code because it is different from what jotofrm generates. I see it...
Read more >
Unable to click on any buttons or submit application on several
a) Press “Windows Logo” + “W” keys from the keyboard. b) Type “Troubleshooting” in the search bar and press “Enter”. c) ...
Read more >
<input type="submit"> - HTML: HyperText Markup Language
<input> elements of type submit are rendered as buttons. When the click event occurs (typically because the user clicked the button), ...
Read more >
Button Type In HTML: Here's Why You Should Always Declare ...
Click me for no reason! ... Reset the form! Submit (disabled). Button Types. There are three types of buttons: submit ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found