Skip to content

PlaywrightCrawler __init__ method browser_new_context_options argument does not function #1784

@ForumeFoundation

Description

@ForumeFoundation

According to the documentation, the browser_new_context_options are the keyword arguments that are accepted by the Playwright Browser new_context method, here:

Keyword arguments to pass to the browser new context method. These options are provided directly to Playwright's browser.new_context method. For more details, refer to the [Playwright documentation](https://playwright.dev/python/docs/api/class-browser#browser-new-context). This option should not be used if browser_pool is provided.

https://crawlee.dev/python/api/class/PlaywrightCrawler#__init__

The appropriate keywords are documented on this page:
https://playwright.dev/python/docs/api/class-browser#browser-new-context

One of those keywords is ** storage_state**.

But...

When I pass the browser_new_context_options to the PlaywrightCrawler.init method, it calls some other function called...

[crawlee.crawlers._playwright._playwright_crawler] WARN Retrying request to ___ due to: BrowserType.launch_persistent_context() got an unexpected keyword argument 'storage_state'. File "./crawlee/browsers/_playwright_browser.py", line 70, in new_context, self._context = await self._browser_type.launch_persistent_context(, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^, user_data_dir=user_data_dir, **launch_options, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^, )

Please update the code to match the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    t-toolingIssues with this label are in the ownership of the tooling team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions