Categories
JavaScript Answers

How to submit a form with Node Puppeteer?

Spread the love

To submit a form with Node Puppeteer, we call click on the submit button.

For instance, we write

await page.goto("https://www.example.com/login");

await page.type("#username", "username");
await page.type("#password", "password");

await page.click("#submit");

await page.waitForNavigation();

to call goto to go to the page.

Then we call type to enter the values for the inputs with IDs username and password.

And then we call click to click the button with ID submit to submit the form.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published.