1

I want to run a basic script that takes a screenshot of the tv schedule each day on a specific url, the url in question has a cookies pop up that requests to be accepted before the rest of the page is displayed, this obviously gets in the way of my intended screenshot, a similar post (Pupeteer - how can I accept cookie consent prompts automatically for any URL?) had a solution that suggested to download the chrome extension 'I don't care about cookies' and then run puppeteer with google chrome with this extension installed, I have installed the extension and ran puppeteer with chrome but the extension does not seem to show up in the chrome window that puppeteer creates, how do I fix this so the extension is there when I run chrome using puppeteer? note: I am intentionally using regular chrome not chromium for this reason, chromium does not allow extensions with puppeteer.

my code:

    const puppeteer = require('puppeteer-core')

       async function main() {
          const browser = await puppeteer.launch({
              headless: false,
              slowMo:10,
              executablePath: '/Applications/Google 
    Chrome.app/Contents/MacOS/Google Chrome',
              args: [
                '--disable-extensions-except=/Applications/Google 
    Chrome.app/Contents/MacOS/Google Chrome',
                '--load-extension=/Applications/Google 
    Chrome.app/Contents/MacOS/Google Chrome',
              ]
          });
          const page = await browser.newPage()
          await page.setViewport({
              width: 980,
              height: 480,
              deviceScaleFactor: 2,
            });
          await 
    page.goto("https://www.tvguide.co.uk/mobile/channellisting.asp? 
          ch=145#588622936")

          await page.waitForTimeout(15000); // wait for 15 seconds
          await browser.close()

      }

      main();

Any reply would be greatly appreciated. Many Thanks.

shange
  • 77
  • 7

0 Answers0