fix(browser): improve storage state persistence in CDP strategy
Enhance storage state persistence mechanism in CDP browser strategy by: - Explicitly saving storage state for each browser context - Using proper file path for storage state - Removing unnecessary sleep delay Also includes test improvements: - Simplified test configurations in playwright tests - Temporarily disabled some CDP tests
This commit is contained in:
@@ -143,15 +143,11 @@ async def test_playwright_context_reuse():
|
||||
|
||||
# Create identical crawler configs
|
||||
crawler_config1 = CrawlerRunConfig(
|
||||
url="https://example.com",
|
||||
viewport_width=1280,
|
||||
viewport_height=800
|
||||
css_selector="body",
|
||||
)
|
||||
|
||||
crawler_config2 = CrawlerRunConfig(
|
||||
url="https://example.org", # Different URL but same browser parameters
|
||||
viewport_width=1280,
|
||||
viewport_height=800
|
||||
css_selector="body",
|
||||
)
|
||||
|
||||
# Get pages with these configs
|
||||
@@ -163,11 +159,7 @@ async def test_playwright_context_reuse():
|
||||
logger.info(f"Contexts reused: {is_same_context}", tag="TEST")
|
||||
|
||||
# Now try with a different config
|
||||
crawler_config3 = CrawlerRunConfig(
|
||||
url="https://example.net",
|
||||
viewport_width=800, # Different viewport size
|
||||
viewport_height=600
|
||||
)
|
||||
crawler_config3 = CrawlerRunConfig()
|
||||
|
||||
page3, context3 = await manager.get_page(crawler_config3)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user