Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to stop closing browser #234

Open
hackerpayne opened this issue Sep 19, 2023 · 1 comment
Open

How to stop closing browser #234

hackerpayne opened this issue Sep 19, 2023 · 1 comment

Comments

@hackerpayne
Copy link

hackerpayne commented Sep 19, 2023

I start one chrome browser at cdp port 40000

i use PLAYWRIGHT_CDP_URL = "http://localhost:40000" in my setting file

but every time scrapy start to work,

it will create new browser,and does't use my openning chrome.

hope someone can help solve this.

In my python code,i use
context = browser.contexts[0] if browser.contexts else browser.new_context()
page = context.pages[len(context.pages) - 1] if context.pages else context.new_page()

to keep opening in one page to work and keep chrome always running.

@elacuesta
Copy link
Member

This is expected, scrapy-playwright will connect and start a context of its own to avoid interfering with other workloads. Unless there's a very strong argument in favor of changing to use the existing context, this will remain the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants