Categories
JavaScript Answers

How to delete existing text from input using Node Puppeteer?

Spread the love

To delete existing text from input using Node Puppeteer, we set the value of the input to an empty string.

For instance, we write

await page.evaluate(() => (document.getElementById("inputID").value = ""));

to call page.evaluate with a callback that gets the input with getElementById.

And we set the value property to an empty string to empty the input.

By John Au-Yeung

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

Leave a Reply

Your email address will not be published.