feat(dynamicSession): add the option to set timezone of the browser
This commit is contained in:
@@ -281,6 +281,7 @@ class DynamicSessionMixin:
|
|||||||
self._wait_selector_state = config.wait_selector_state
|
self._wait_selector_state = config.wait_selector_state
|
||||||
self._extra_flags = config.extra_flags
|
self._extra_flags = config.extra_flags
|
||||||
self._selector_config = config.selector_config
|
self._selector_config = config.selector_config
|
||||||
|
self._timezone_id = config.timezone_id
|
||||||
self._additional_args = config.additional_args
|
self._additional_args = config.additional_args
|
||||||
self._page_action = config.page_action
|
self._page_action = config.page_action
|
||||||
self._user_data_dir = config.user_data_dir
|
self._user_data_dir = config.user_data_dir
|
||||||
@@ -304,6 +305,7 @@ class DynamicSessionMixin:
|
|||||||
self._stealth,
|
self._stealth,
|
||||||
self._hide_canvas,
|
self._hide_canvas,
|
||||||
self._disable_webgl,
|
self._disable_webgl,
|
||||||
|
self._timezone_id,
|
||||||
tuple(self._extra_flags) if self._extra_flags else tuple(),
|
tuple(self._extra_flags) if self._extra_flags else tuple(),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ def _launch_kwargs(
|
|||||||
stealth,
|
stealth,
|
||||||
hide_canvas,
|
hide_canvas,
|
||||||
disable_webgl,
|
disable_webgl,
|
||||||
|
timezone_id,
|
||||||
extra_flags: Tuple,
|
extra_flags: Tuple,
|
||||||
) -> Tuple:
|
) -> Tuple:
|
||||||
"""Creates the arguments we will use while launching playwright's browser"""
|
"""Creates the arguments we will use while launching playwright's browser"""
|
||||||
@@ -79,6 +80,7 @@ def _launch_kwargs(
|
|||||||
|
|
||||||
launch_kwargs = {
|
launch_kwargs = {
|
||||||
"locale": locale,
|
"locale": locale,
|
||||||
|
"timezone_id": timezone_id or None,
|
||||||
"headless": headless,
|
"headless": headless,
|
||||||
"args": base_args,
|
"args": base_args,
|
||||||
"color_scheme": "dark", # Bypasses the 'prefersLightColor' check in creepjs
|
"color_scheme": "dark", # Bypasses the 'prefersLightColor' check in creepjs
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ class PlaywrightConfig(Struct, kw_only=True, frozen=False, weakref=True):
|
|||||||
load_dom: bool = True
|
load_dom: bool = True
|
||||||
wait_selector_state: SelectorWaitStates = "attached"
|
wait_selector_state: SelectorWaitStates = "attached"
|
||||||
user_data_dir: str = ""
|
user_data_dir: str = ""
|
||||||
|
timezone_id: str = ""
|
||||||
extra_flags: Optional[List[str]] = None
|
extra_flags: Optional[List[str]] = None
|
||||||
selector_config: Optional[Dict] = {}
|
selector_config: Optional[Dict] = {}
|
||||||
additional_args: Optional[Dict] = {}
|
additional_args: Optional[Dict] = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user