#Set 'ignoreHTTPSErrors' on a PlaywrightCrawler

1 messages · Page 1 of 1 (latest)

gloomy lava
#

Hi everyone,

I need to set the ignoreHTTPSErrors flag for a Playwright crawler.
const crawler = new PlaywrightCrawler({ launchContext: { launchOptions: { ignoreHTTPSErrors: true, } }, requestHandler: router });
seems to work, but errors on

Type '{ ignoreHTTPSErrors: true; }' is not assignable to type 'LaunchOptions'.\n Object literal may only specify known properties, and 'ignoreHTTPSErrors' does not exist in type 'LaunchOptions'.",

What's the standard way of setting this?
Thanks in advance

cerulean lakeBOT
#

@gloomy lava just advanced to level 1! Thanks for your contributions! 🎉

austere spindle
#

Can toy send me the site, I will test it

dense valve
gloomy lava
#

Hi Lukas, Honza, thanks for your answers!
I'm not sure I understand, do you tell me that I need to create a new context to set this flag?
I need this to be set at crawler level, can I define this flag for current browser context and those who will eventually be created?

gloomy lava
#

@dense valve @austere spindle can you help me with setting this flag at a crawler level? What am I doing wrong?

dense valve
#

I would try to change it in the browser context in preNavigationHooks but I am not sure it will work. If you share what site you want to scrape maybe more people can help you.

gloomy lava
#

I can't share any specific site because we wan't to provide a list of URL for this crawler, some of them in 'http'. This is why we wan't to set this flag at the crawler level.

torpid stump
#

Could you please try adding

browserPoolOptions: {
            preLaunchHooks: [
                async (_, launchContext) => {
                    launchContext.ignoreHTTPSErrors = true;
                },
            ],
        },

to crawler options? The thing is - launchContext has browser launch options, while ignoreHTTPSErrors is new context option, therefore you have to use the preLaunchHooks. I am not sure however whether it's launchContext.ignoreHTTPSErrors or launchContext.launchOptions.ignoreHTTPSErrors

gloomy lava
#

It works, thanks for this Andrey!