File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -256,6 +256,10 @@ def __prepare_proxy_aiohttp(self, proxy: ProxySettings) -> str:
256256
257257 async def __aenter__ (self ) -> Capture :
258258 '''Launch the browser'''
259+ # Ignore the fonts by the time we take the screenshot
260+ # 2026-02-02: the environment is copied into the process when initialized, so we need to set it globally here,
261+ # and not in the method where we take the screenshot
262+ os .environ ['PW_TEST_SCREENSHOT_NO_FONTS_READY' ] = '1'
259263 self .playwright = await async_playwright ().start ()
260264
261265 if self .device_name :
@@ -1211,9 +1215,6 @@ async def _override_content_disposition_handler(route: Route, request: Request)
12111215
12121216 to_return ['frames' ] = await self .make_frame_tree (page .main_frame )
12131217
1214- if with_screenshot :
1215- to_return ['png' ] = await self ._failsafe_get_screenshot (page )
1216-
12171218 # ### --------------------------------------
12181219
12191220 # The first content is what we call rendered HTML, keep it as-is
@@ -1237,6 +1238,9 @@ async def _override_content_disposition_handler(route: Route, request: Request)
12371238 except Exception as e :
12381239 self .logger .warning (f'Unable to get favicons: { e } ' )
12391240
1241+ if with_screenshot :
1242+ to_return ['png' ] = await self ._failsafe_get_screenshot (page )
1243+
12401244 # Keep that all the way down there in case the capture failed.
12411245 self ._already_captured .add (url )
12421246
You can’t perform that action at this time.
0 commit comments