Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save senthilmpro/101f90f9ae0d499ff6a6e7c8c214d5f6 to your computer and use it in GitHub Desktop.
Save senthilmpro/101f90f9ae0d499ff6a6e7c8c214d5f6 to your computer and use it in GitHub Desktop.
Replace HTML Selector inner text/ content via Google Puppeteer script
async function setSelectVal(sel, val) {
await page.evaluate((data) => {
// this innerHTML can be replaced with .value (based on HTML type)
return document.querySelector(data.sel).innerHTML = data.val;
}, {sel, val});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment