I'm trying to click on an anchor link within a page that'll open a new tab to export a PDF, but this link lives within a frame inside a frameset like this:
I tried this:
//[login and navigating to the page]
//wait for schedule page
await page.waitForSelector(`frameset`);
//select content frame
const frame = (await page.$("frame[name='link']"));
/*clicking the button after looking for it allow the page to scroll until the button is in frame before clicking it*/
const pdfExport = await frame.$(`a[href='pdf.jsp?clearTree=false']`)
await pdfExport.evaluate(b => b.click()); //error here
await browser.close();
but I get this error:
TypeError: Cannot read properties of null (reading 'evaluate')
at C:\Projects\scrapproject\Main.js:69:25
at processTicksAndRejections (node:internal/process/task_queues:96:5)
it seems that it cannot find my a link button but I cannot figure out how to click it. Can you help me please ?
