Skip to content

Cannot pass gotoOptions to page.goto() #1756

Answered by mvolfik
matjaeck asked this question in Q&A
Discussion options

You must be logged in to vote

Hi! Sorry that we didn't reply earlier.

If you are interested in calling page.goto(url, options) in your request handler (= scraping code), that is not affected by Crawlee at all - the call goes directly to Puppeteer/Playwright.

The code that you linked to affects navigation, when Crawlee opens the target URL in the browser to allow you to scrape it. What exactly is your use-case that you want to modify gotoOptions there? But a cleaner workaround that I can suggest is using preNavigationHooks when creating your Crawler, for example like this:

const crawler = new PlaywrightCrawler({
  requestHandler: router,
  headless: true,
  preNavigationHooks: [
    async ({ request }, gotoOptions) => {

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by matjaeck
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bug Something isn't working.
2 participants
Converted from issue

This discussion was converted from issue #1631 on January 26, 2023 15:00.