Currently, I am in the process of learning the Puppeteer API with version 1.9.0. Below is the code I am using to click a button within an iframe:
const changePrefsFromAllToNone = async () => {
try {
const browser = await puppeteer.launch({
headless:false,
slowMo: 250});
const page = await browser.newPage();
await page.setViewport({width: 1280, height: 800});
await page.goto(baseUrl);
await page.waitForSelector('.widget-title');
const frame = page.frames().find(f => f.name() === 'iframe');
const prefsDenyButton = await frame.$eval('#option-refuse-phv1L');
prefsDenyButton.click();
} catch (error) {
console.log(error);
}
};
changePrefsFromAllToNone();
There is an error message stating:
Error: The following is not a function: undefined
at ExecutionContext.evaluateHandle
I referenced the example directly from the Puppeteer website: https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#