PlaywrightCapture 1.42.2__tar.gz → 1.42.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {playwrightcapture-1.42.2 → playwrightcapture-1.42.3}/PKG-INFO +1 -1
- {playwrightcapture-1.42.2 → playwrightcapture-1.42.3}/playwrightcapture/capture.py +10 -20
- {playwrightcapture-1.42.2 → playwrightcapture-1.42.3}/pyproject.toml +1 -1
- {playwrightcapture-1.42.2 → playwrightcapture-1.42.3}/LICENSE +0 -0
- {playwrightcapture-1.42.2 → playwrightcapture-1.42.3}/README.md +0 -0
- {playwrightcapture-1.42.2 → playwrightcapture-1.42.3}/playwrightcapture/__init__.py +0 -0
- {playwrightcapture-1.42.2 → playwrightcapture-1.42.3}/playwrightcapture/exceptions.py +0 -0
- {playwrightcapture-1.42.2 → playwrightcapture-1.42.3}/playwrightcapture/helpers.py +0 -0
- {playwrightcapture-1.42.2 → playwrightcapture-1.42.3}/playwrightcapture/py.typed +0 -0
- {playwrightcapture-1.42.2 → playwrightcapture-1.42.3}/playwrightcapture/socks5dnslookup.py +0 -0
|
@@ -546,45 +546,35 @@ class Capture():
|
|
|
546
546
|
async def initialize_context(self) -> None:
|
|
547
547
|
device_context_settings = {}
|
|
548
548
|
vp: dict[str, int] | None = None
|
|
549
|
-
no_viewport = True
|
|
550
549
|
if self.device_name:
|
|
551
550
|
device_context_settings = self.playwright.devices[self.device_name]
|
|
552
551
|
# We need to make sure the device_context_settings dict doesn't contains
|
|
553
552
|
# keys that are set by default in the context creation
|
|
554
553
|
ua = device_context_settings.pop('user_agent', self._user_agent)
|
|
555
554
|
vp = device_context_settings.pop('viewport', self._viewport)
|
|
556
|
-
# NOTE 2026-10-13: cannot set no_viewport if either scale factor or ismobile are set:
|
|
557
|
-
# https://github.com/microsoft/playwright/blob/a3401cfe0dcf317101572d025fa46248d0779b42/packages/playwright-core/src/server/browserContext.ts#L755
|
|
558
|
-
if 'device_scale_factor' in device_context_settings or 'is_mobile' in device_context_settings:
|
|
559
|
-
no_viewport = False
|
|
560
555
|
else:
|
|
561
556
|
ua = self._user_agent
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
# self._env.update({'DEBUG': 'pw:protocol'})
|
|
571
|
-
# Playwright bug: https://github.com/microsoft/playwright/issues/40149
|
|
572
|
-
# So skip the viewport for now, it's not a very big deal.
|
|
573
|
-
# if self.remote_headfull and self.browser_name == 'webkit':
|
|
574
|
-
# vp = None
|
|
557
|
+
if self._viewport:
|
|
558
|
+
vp = self._viewport
|
|
559
|
+
elif self.headless:
|
|
560
|
+
vp = self._default_viewport
|
|
561
|
+
else:
|
|
562
|
+
# headfull mode and no viewport in the settings, vp is intentionally None
|
|
563
|
+
# no_viewport is then passed as True, allowing resizing.
|
|
564
|
+
pass
|
|
575
565
|
|
|
576
566
|
self.context = await self.browser.new_context(
|
|
577
567
|
record_har_path=self._temp_harfile.name,
|
|
578
568
|
ignore_https_errors=True,
|
|
579
569
|
bypass_csp=True,
|
|
580
|
-
no_viewport=
|
|
570
|
+
no_viewport=vp is None, # Allows resize in headfull mode.
|
|
581
571
|
java_script_enabled=self._java_script_enabled,
|
|
582
572
|
http_credentials=self._http_credentials, # type: ignore[arg-type]
|
|
583
573
|
user_agent=ua,
|
|
584
574
|
locale=self._locale,
|
|
585
575
|
timezone_id=self._timezone_id,
|
|
586
576
|
color_scheme=self._color_scheme,
|
|
587
|
-
viewport=vp
|
|
577
|
+
viewport=vp, # type: ignore[arg-type]
|
|
588
578
|
storage_state=self._storage, # type: ignore[arg-type]
|
|
589
579
|
record_video_dir=self._temp_video_dir.name if self._temp_video_dir else None,
|
|
590
580
|
record_video_size=self.__video_size(vp) if self._temp_video_dir else None, # type: ignore[arg-type]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|