File tree Expand file tree Collapse file tree
src/crawlee/crawlers/_adaptive_playwright Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ async def from_playwright_crawling_context(
188188 context_kwargs ['_page' ] = context_kwargs .pop ('page' )
189189 context_kwargs ['_infinite_scroll' ] = context_kwargs .pop ('infinite_scroll' )
190190 # This might not be always available.
191- protocol_guess = await context_kwargs ['_page' ].evaluate ('() => performance.getEntries()[0].nextHopProtocol' )
191+ protocol_guess = await context_kwargs ['_page' ].evaluate ('() => performance.getEntries()[0]? .nextHopProtocol' )
192192 http_response = await PlaywrightHttpResponse .from_playwright_response (
193193 response = context .response , protocol = protocol_guess or ''
194194 )
@@ -295,7 +295,9 @@ async def from_post_navigation_context(
295295 context_kwargs .pop ('goto_options' , None )
296296
297297 if isinstance (context , PlaywrightPostNavCrawlingContext ):
298- protocol_guess = await context_kwargs ['_page' ].evaluate ('() => performance.getEntries()[0].nextHopProtocol' )
298+ protocol_guess = await context_kwargs ['_page' ].evaluate (
299+ '() => performance.getEntries()[0]?.nextHopProtocol'
300+ )
299301 context_kwargs ['http_response' ] = await PlaywrightHttpResponse .from_playwright_response (
300302 response = context .response , protocol = protocol_guess or ''
301303 )
You can’t perform that action at this time.
0 commit comments