[question] How to reuse existing browser context?
See original GitHub issueLong into my program, Scrapy is starting at a particular point. I’ve already launched a browser, and logged into an application. I would like to reuse the existing browser context and crawl through the application.
I can pass:
- browser instance:
<Browser type=<BrowserType name=chromium executable_path=/.../chrome> version=104.0.5112.20>
- it’s active context:
<BrowserContext browser=<Browser type=<BrowserType name=chromium executable_path=/.../chrome> version=104.0.5112.20>>
- and the even
Page
object:<Page url='https://demo.testfire.net/index.jsp'>
to scrapy-playwright
configuration.
meta = {
'dont_merge_cookies': True,
'handle_httpstatus_list': [404, 302],
'playwright': system().lower() in {'linux', 'darwin'},
'playwright_context': # ???
}
But looking at #supported-settings & #browser-contexts sections in the README
, I’m not sure how to put it as a dictionary precisely.
Please help. Thanks!
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to reuse existing browser session, instead of opening ...
In short, each command like webelement.click() is mapped to some REST endpoint like /session/{sessionID}/element/{elementID}/click with a http ...
Read more >How to reuse existing Selenium browser session - Qxf2 BLOG
This post shows you how to do just that! This would help you to debug the locators used quickly, instead of running your...
Read more >How to reuse a selenium browser session - Stack Overflow
from selenium import webdriver def ; main(): """ reuse window in different scripts """ driver = webdriver.Chrome() executor_url = driver.
Read more >[Question] Attaching playwright to an existing browser window?
I have a browser I launched with ChromeDriver (the Testim editor) and I want it to run a test authored in playwright in...
Read more >Reuse your existing assets and best practices - YOOI
Enable easy discovery and reuse of existing assets, provide access to usage context to build ... Questions and challenges people face in each...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Glad to hear, thanks for the update.
Hi, yes. I resolved it yesterday evening. Here’s what I did:
scrapy-playwright
library handle it.storage_state
(had a typo earlier) to it.'referer'
as theresponse.url
for request continuity.For anyone who might stumble upon this. Updated code:
Feel free to (re)close this a complete. Thanks for the help!