osn-selenium 1.0.0__py3-none-any.whl → 1.1.0__py3-none-any.whl
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.
- osn_selenium/_base_models.py +41 -0
- osn_selenium/_cdp_import.py +253 -0
- osn_selenium/abstract/executors/cdp.py +63 -0
- osn_selenium/browsers_handler/models.py +1 -1
- osn_selenium/dev_tools/_decorators.py +19 -10
- osn_selenium/dev_tools/_typehints.py +5 -2
- osn_selenium/dev_tools/_wrappers.py +0 -3
- osn_selenium/dev_tools/domains/__init__.py +2 -2
- osn_selenium/dev_tools/domains/abstract.py +1 -1
- osn_selenium/dev_tools/domains/fetch.py +1 -1
- osn_selenium/dev_tools/domains_default/fetch.py +1 -1
- osn_selenium/dev_tools/filters.py +1 -1
- osn_selenium/dev_tools/logger/main.py +0 -12
- osn_selenium/dev_tools/logger/models.py +1 -1
- osn_selenium/dev_tools/logger/target.py +42 -22
- osn_selenium/dev_tools/manager/base.py +0 -23
- osn_selenium/dev_tools/manager/lifecycle.py +1 -1
- osn_selenium/dev_tools/models.py +1 -1
- osn_selenium/dev_tools/settings.py +5 -1
- osn_selenium/dev_tools/target/base.py +12 -23
- osn_selenium/dev_tools/target/lifecycle.py +6 -1
- osn_selenium/dev_tools/target/logging.py +10 -2
- osn_selenium/exceptions/dependencies.py +60 -0
- osn_selenium/executors/sync/cdp.py +100 -0
- osn_selenium/executors/trio_threads/cdp.py +104 -0
- osn_selenium/executors/trio_threads/javascript.py +1 -1
- osn_selenium/executors/unified/javascript.py +0 -4
- osn_selenium/flags/base.py +1 -9
- osn_selenium/flags/blink.py +0 -6
- osn_selenium/flags/models/base.py +4 -4
- osn_selenium/flags/models/blink.py +1 -1
- osn_selenium/flags/models/values.py +1 -1
- osn_selenium/instances/sync/action_chains/__init__.py +6 -0
- osn_selenium/instances/sync/shadow_root.py +30 -8
- osn_selenium/instances/trio_threads/action_chains/__init__.py +6 -0
- osn_selenium/instances/trio_threads/action_chains/base.py +1 -1
- osn_selenium/instances/trio_threads/alert.py +1 -1
- osn_selenium/instances/trio_threads/browser.py +1 -1
- osn_selenium/instances/trio_threads/browsing_context.py +1 -1
- osn_selenium/instances/trio_threads/dialog.py +1 -1
- osn_selenium/instances/trio_threads/fedcm.py +1 -1
- osn_selenium/instances/trio_threads/mobile.py +1 -1
- osn_selenium/instances/trio_threads/network.py +1 -1
- osn_selenium/instances/trio_threads/permissions.py +1 -1
- osn_selenium/instances/trio_threads/script.py +1 -1
- osn_selenium/instances/trio_threads/shadow_root.py +46 -15
- osn_selenium/instances/trio_threads/storage.py +1 -1
- osn_selenium/instances/trio_threads/switch_to.py +1 -1
- osn_selenium/instances/trio_threads/web_driver_wait.py +1 -1
- osn_selenium/instances/trio_threads/web_element.py +1 -1
- osn_selenium/instances/trio_threads/web_extension.py +1 -1
- osn_selenium/javascript/fingerprint/__init__.py +1 -1
- osn_selenium/javascript/fingerprint/registry/models.py +1 -1
- osn_selenium/javascript/fingerprint/spoof/core_rules.py +1 -1
- osn_selenium/javascript/fingerprint/spoof/noise.py +1 -1
- osn_selenium/javascript/models.py +1 -1
- osn_selenium/models.py +2 -47
- osn_selenium/trio_threads_mixin.py +159 -0
- osn_selenium/webdrivers/_args_helpers.py +2 -2
- osn_selenium/webdrivers/_bridges.py +2 -2
- osn_selenium/webdrivers/_executable_tables/models.py +1 -1
- osn_selenium/webdrivers/sync/blink/__init__.py +11 -1
- osn_selenium/webdrivers/sync/blink/base.py +13 -1
- osn_selenium/webdrivers/sync/chrome/__init__.py +36 -1
- osn_selenium/webdrivers/sync/chrome/base.py +13 -1
- osn_selenium/webdrivers/sync/core/__init__.py +10 -1
- osn_selenium/webdrivers/sync/core/base.py +16 -8
- osn_selenium/webdrivers/sync/edge/__init__.py +36 -1
- osn_selenium/webdrivers/sync/edge/base.py +13 -1
- osn_selenium/webdrivers/sync/yandex/__init__.py +36 -1
- osn_selenium/webdrivers/sync/yandex/base.py +13 -1
- osn_selenium/webdrivers/trio_threads/blink/__init__.py +11 -1
- osn_selenium/webdrivers/trio_threads/blink/base.py +11 -1
- osn_selenium/webdrivers/trio_threads/blink/casting.py +1 -1
- osn_selenium/webdrivers/trio_threads/blink/features.py +1 -1
- osn_selenium/webdrivers/trio_threads/blink/logging.py +1 -1
- osn_selenium/webdrivers/trio_threads/blink/network.py +1 -1
- osn_selenium/webdrivers/trio_threads/chrome/__init__.py +34 -1
- osn_selenium/webdrivers/trio_threads/chrome/base.py +14 -2
- osn_selenium/webdrivers/trio_threads/core/__init__.py +10 -4
- osn_selenium/webdrivers/trio_threads/core/actions.py +1 -1
- osn_selenium/webdrivers/trio_threads/core/auth.py +1 -1
- osn_selenium/webdrivers/trio_threads/core/base.py +15 -7
- osn_selenium/webdrivers/trio_threads/core/capture.py +1 -1
- osn_selenium/webdrivers/trio_threads/core/comonents.py +1 -1
- osn_selenium/webdrivers/trio_threads/core/devtools.py +1 -1
- osn_selenium/webdrivers/trio_threads/core/element.py +1 -1
- osn_selenium/webdrivers/trio_threads/core/file.py +2 -2
- osn_selenium/webdrivers/trio_threads/core/lifecycle.py +1 -1
- osn_selenium/webdrivers/trio_threads/core/navigation.py +1 -1
- osn_selenium/webdrivers/trio_threads/core/script.py +1 -1
- osn_selenium/webdrivers/trio_threads/core/settings.py +1 -1
- osn_selenium/webdrivers/trio_threads/core/storage.py +1 -1
- osn_selenium/webdrivers/trio_threads/core/timeouts.py +1 -1
- osn_selenium/webdrivers/trio_threads/core/window.py +3 -3
- osn_selenium/webdrivers/trio_threads/edge/__init__.py +34 -1
- osn_selenium/webdrivers/trio_threads/edge/base.py +14 -2
- osn_selenium/webdrivers/trio_threads/yandex/__init__.py +34 -1
- osn_selenium/webdrivers/trio_threads/yandex/base.py +14 -2
- osn_selenium/webdrivers/unified/blink/base.py +5 -1
- osn_selenium/webdrivers/unified/chrome/base.py +5 -1
- osn_selenium/webdrivers/unified/core/base.py +9 -2
- osn_selenium/webdrivers/unified/edge/base.py +5 -1
- osn_selenium/webdrivers/unified/yandex/base.py +5 -1
- {osn_selenium-1.0.0.dist-info → osn_selenium-1.1.0.dist-info}/METADATA +22 -9
- {osn_selenium-1.0.0.dist-info → osn_selenium-1.1.0.dist-info}/RECORD +108 -101
- {osn_selenium-1.0.0.dist-info → osn_selenium-1.1.0.dist-info}/WHEEL +1 -1
- {osn_selenium-1.0.0.dist-info → osn_selenium-1.1.0.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
from typing import Optional, Type
|
|
2
1
|
from osn_selenium.models import WindowRect
|
|
2
|
+
from typing import (
|
|
3
|
+
Mapping,
|
|
4
|
+
Optional,
|
|
5
|
+
Type
|
|
6
|
+
)
|
|
3
7
|
from osn_selenium.flags.chrome import ChromeFlagsManager
|
|
4
8
|
from osn_selenium.flags.models.chrome import ChromeFlags
|
|
5
9
|
from selenium.webdriver import (
|
|
@@ -44,6 +48,8 @@ class ChromeBaseMixin(UnifiedChromeBaseMixin, BlinkBaseMixin, AbstractChromeBase
|
|
|
44
48
|
page_load_timeout: int = 5,
|
|
45
49
|
script_timeout: int = 5,
|
|
46
50
|
window_rect: Optional[WindowRect] = None,
|
|
51
|
+
cdp_versioned_packages_paths: Optional[Mapping[int, PATH_TYPEHINT]] = None,
|
|
52
|
+
ignore_cdp_version_package_missing: bool = True,
|
|
47
53
|
):
|
|
48
54
|
"""
|
|
49
55
|
Initializes the synchronous Chrome WebDriver mixin with specified configuration.
|
|
@@ -67,6 +73,8 @@ class ChromeBaseMixin(UnifiedChromeBaseMixin, BlinkBaseMixin, AbstractChromeBase
|
|
|
67
73
|
script_timeout (int): Default script execution timeout in seconds. Defaults to 5.
|
|
68
74
|
window_rect (Optional[WindowRect]): Initial window dimensions and position.
|
|
69
75
|
If None, browser defaults are used.
|
|
76
|
+
cdp_versioned_packages_paths (Optional[Mapping[int, PATH_TYPEHINT]]): Custom local paths for specific CDP versions packages.
|
|
77
|
+
ignore_cdp_version_package_missing (bool): Whether to ignore missing CDP package errors.
|
|
70
78
|
"""
|
|
71
79
|
|
|
72
80
|
BlinkBaseMixin.__init__(
|
|
@@ -83,6 +91,8 @@ class ChromeBaseMixin(UnifiedChromeBaseMixin, BlinkBaseMixin, AbstractChromeBase
|
|
|
83
91
|
page_load_timeout=page_load_timeout,
|
|
84
92
|
script_timeout=script_timeout,
|
|
85
93
|
window_rect=window_rect,
|
|
94
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
95
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
86
96
|
)
|
|
87
97
|
|
|
88
98
|
UnifiedChromeBaseMixin.__init__(
|
|
@@ -99,6 +109,8 @@ class ChromeBaseMixin(UnifiedChromeBaseMixin, BlinkBaseMixin, AbstractChromeBase
|
|
|
99
109
|
page_load_timeout=page_load_timeout,
|
|
100
110
|
script_timeout=script_timeout,
|
|
101
111
|
window_rect=window_rect,
|
|
112
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
113
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
102
114
|
)
|
|
103
115
|
|
|
104
116
|
@property
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
from typing import Optional, Type
|
|
2
1
|
from osn_selenium.models import WindowRect
|
|
2
|
+
from typing import (
|
|
3
|
+
Mapping,
|
|
4
|
+
Optional,
|
|
5
|
+
Type
|
|
6
|
+
)
|
|
7
|
+
from osn_selenium._typehints import PATH_TYPEHINT
|
|
3
8
|
from osn_selenium.flags.base import BrowserFlagsManager
|
|
4
9
|
from osn_selenium.flags.models.base import BrowserFlags
|
|
5
10
|
from osn_selenium.webdrivers.sync.core.auth import CoreAuthMixin
|
|
@@ -59,6 +64,8 @@ class CoreWebDriver(
|
|
|
59
64
|
page_load_timeout: int = 5,
|
|
60
65
|
script_timeout: int = 5,
|
|
61
66
|
window_rect: Optional[WindowRect] = None,
|
|
67
|
+
cdp_versioned_packages_paths: Optional[Mapping[int, PATH_TYPEHINT]] = None,
|
|
68
|
+
ignore_cdp_version_package_missing: bool = True,
|
|
62
69
|
) -> None:
|
|
63
70
|
"""
|
|
64
71
|
Initializes the synchronous WebDriver instance.
|
|
@@ -88,4 +95,6 @@ class CoreWebDriver(
|
|
|
88
95
|
page_load_timeout=page_load_timeout,
|
|
89
96
|
script_timeout=script_timeout,
|
|
90
97
|
window_rect=window_rect,
|
|
98
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
99
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
91
100
|
)
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
from osn_selenium.models import WindowRect
|
|
2
|
-
from typing import (
|
|
3
|
-
Any,
|
|
4
|
-
Dict,
|
|
5
|
-
Optional,
|
|
6
|
-
Type
|
|
7
|
-
)
|
|
8
2
|
from osn_selenium.executors.sync.cdp import CDPExecutor
|
|
9
3
|
from osn_selenium.flags.base import BrowserFlagsManager
|
|
10
4
|
from osn_selenium.flags.models.base import BrowserFlags
|
|
11
5
|
from selenium.webdriver.common.bidi.session import Session
|
|
12
6
|
from osn_selenium.executors.sync.javascript import JSExecutor
|
|
13
|
-
from
|
|
14
|
-
|
|
7
|
+
from typing import (
|
|
8
|
+
Any,
|
|
9
|
+
Dict,
|
|
10
|
+
Mapping,
|
|
11
|
+
Optional,
|
|
12
|
+
Type
|
|
15
13
|
)
|
|
16
14
|
from selenium.webdriver.remote.errorhandler import ErrorHandler
|
|
17
15
|
from selenium.webdriver.remote.locator_converter import LocatorConverter
|
|
18
16
|
from selenium.webdriver.remote.remote_connection import RemoteConnection
|
|
19
17
|
from osn_selenium.webdrivers.unified.core.base import UnifiedCoreBaseMixin
|
|
18
|
+
from osn_selenium._typehints import (
|
|
19
|
+
ARCHITECTURES_TYPEHINT,
|
|
20
|
+
PATH_TYPEHINT
|
|
21
|
+
)
|
|
20
22
|
from osn_selenium.abstract.webdriver.core.base import (
|
|
21
23
|
AbstractCoreBaseMixin
|
|
22
24
|
)
|
|
@@ -48,6 +50,8 @@ class CoreBaseMixin(UnifiedCoreBaseMixin, AbstractCoreBaseMixin):
|
|
|
48
50
|
page_load_timeout: int = 5,
|
|
49
51
|
script_timeout: int = 5,
|
|
50
52
|
window_rect: Optional[WindowRect] = None,
|
|
53
|
+
cdp_versioned_packages_paths: Optional[Mapping[int, PATH_TYPEHINT]] = None,
|
|
54
|
+
ignore_cdp_version_package_missing: bool = True,
|
|
51
55
|
) -> None:
|
|
52
56
|
"""
|
|
53
57
|
Initializes the base mixin for synchronous WebDrivers.
|
|
@@ -66,6 +70,8 @@ class CoreBaseMixin(UnifiedCoreBaseMixin, AbstractCoreBaseMixin):
|
|
|
66
70
|
asynchronous script to finish execution. Defaults to 5.
|
|
67
71
|
window_rect (Optional[WindowRect]): The initial size and position of the
|
|
68
72
|
browser window. Defaults to None.
|
|
73
|
+
cdp_versioned_packages_paths (Optional[Mapping[int, PATH_TYPEHINT]]): Custom local paths for specific CDP versions packages.
|
|
74
|
+
ignore_cdp_version_package_missing (bool): Whether to ignore missing CDP package errors.
|
|
69
75
|
"""
|
|
70
76
|
|
|
71
77
|
UnifiedCoreBaseMixin.__init__(
|
|
@@ -78,6 +84,8 @@ class CoreBaseMixin(UnifiedCoreBaseMixin, AbstractCoreBaseMixin):
|
|
|
78
84
|
page_load_timeout=page_load_timeout,
|
|
79
85
|
script_timeout=script_timeout,
|
|
80
86
|
window_rect=window_rect,
|
|
87
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
88
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
81
89
|
)
|
|
82
90
|
|
|
83
91
|
self._cdp_executor = CDPExecutor(execute_function=get_cdp_executor_bridge(self))
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
from typing import Optional, Type
|
|
2
1
|
from osn_selenium.models import WindowRect
|
|
2
|
+
from typing import (
|
|
3
|
+
Mapping,
|
|
4
|
+
Optional,
|
|
5
|
+
Type
|
|
6
|
+
)
|
|
3
7
|
from osn_selenium._typehints import PATH_TYPEHINT
|
|
4
8
|
from osn_selenium.flags.edge import EdgeFlagsManager
|
|
5
9
|
from osn_selenium.flags.models.edge import EdgeFlags
|
|
@@ -35,7 +39,34 @@ class EdgeWebDriver(
|
|
|
35
39
|
page_load_timeout: int = 5,
|
|
36
40
|
script_timeout: int = 5,
|
|
37
41
|
window_rect: Optional[WindowRect] = None,
|
|
42
|
+
cdp_versioned_packages_paths: Optional[Mapping[int, PATH_TYPEHINT]] = None,
|
|
43
|
+
ignore_cdp_version_package_missing: bool = True,
|
|
38
44
|
):
|
|
45
|
+
"""
|
|
46
|
+
Initializes the synchronous Edge WebDriver with specified configuration.
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
webdriver_path (str): Path to the EdgeDriver executable.
|
|
50
|
+
flags_manager_type (Type[EdgeFlagsManager]): The class type used for managing Edge flags.
|
|
51
|
+
Defaults to EdgeFlagsManager.
|
|
52
|
+
use_browser_exe (bool): Whether to use a specific browser executable path or auto-detect.
|
|
53
|
+
Defaults to True.
|
|
54
|
+
browser_name_in_system (str): The name of the browser in the system registry or path.
|
|
55
|
+
Defaults to "Microsoft Edge".
|
|
56
|
+
browser_exe (Optional[PATH_TYPEHINT]): Explicit path to the Edge browser executable.
|
|
57
|
+
If None, it may be auto-detected based on other parameters.
|
|
58
|
+
flags (Optional[EdgeFlags]): Initial set of flags to configure the Edge instance.
|
|
59
|
+
start_page_url (str): The URL to navigate to immediately upon startup.
|
|
60
|
+
Defaults to "about:blank".
|
|
61
|
+
implicitly_wait (int): Default implicit wait time in seconds. Defaults to 5.
|
|
62
|
+
page_load_timeout (int): Default page load timeout in seconds. Defaults to 5.
|
|
63
|
+
script_timeout (int): Default script execution timeout in seconds. Defaults to 5.
|
|
64
|
+
window_rect (Optional[WindowRect]): Initial window dimensions and position.
|
|
65
|
+
If None, browser defaults are used.
|
|
66
|
+
cdp_versioned_packages_paths (Optional[Mapping[int, PATH_TYPEHINT]]): Custom local paths for specific CDP versions packages.
|
|
67
|
+
ignore_cdp_version_package_missing (bool): Whether to ignore missing CDP package errors.
|
|
68
|
+
"""
|
|
69
|
+
|
|
39
70
|
BlinkWebDriver.__init__(
|
|
40
71
|
self,
|
|
41
72
|
browser_exe=browser_exe,
|
|
@@ -48,6 +79,8 @@ class EdgeWebDriver(
|
|
|
48
79
|
page_load_timeout=page_load_timeout,
|
|
49
80
|
script_timeout=script_timeout,
|
|
50
81
|
window_rect=window_rect,
|
|
82
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
83
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
51
84
|
)
|
|
52
85
|
|
|
53
86
|
EdgeBaseMixin.__init__(
|
|
@@ -64,4 +97,6 @@ class EdgeWebDriver(
|
|
|
64
97
|
page_load_timeout=page_load_timeout,
|
|
65
98
|
script_timeout=script_timeout,
|
|
66
99
|
window_rect=window_rect,
|
|
100
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
101
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
67
102
|
)
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
from typing import Optional, Type
|
|
2
1
|
from osn_selenium.models import WindowRect
|
|
2
|
+
from typing import (
|
|
3
|
+
Mapping,
|
|
4
|
+
Optional,
|
|
5
|
+
Type
|
|
6
|
+
)
|
|
3
7
|
from selenium.webdriver import Edge as legacyEdge
|
|
4
8
|
from osn_selenium.flags.edge import EdgeFlagsManager
|
|
5
9
|
from osn_selenium.flags.models.edge import EdgeFlags
|
|
@@ -40,6 +44,8 @@ class EdgeBaseMixin(UnifiedEdgeBaseMixin, BlinkBaseMixin, AbstractEdgeBaseMixin)
|
|
|
40
44
|
page_load_timeout: int = 5,
|
|
41
45
|
script_timeout: int = 5,
|
|
42
46
|
window_rect: Optional[WindowRect] = None,
|
|
47
|
+
cdp_versioned_packages_paths: Optional[Mapping[int, PATH_TYPEHINT]] = None,
|
|
48
|
+
ignore_cdp_version_package_missing: bool = True,
|
|
43
49
|
):
|
|
44
50
|
"""
|
|
45
51
|
Initializes the synchronous Edge WebDriver mixin with specified configuration.
|
|
@@ -63,6 +69,8 @@ class EdgeBaseMixin(UnifiedEdgeBaseMixin, BlinkBaseMixin, AbstractEdgeBaseMixin)
|
|
|
63
69
|
script_timeout (int): Default script execution timeout in seconds. Defaults to 5.
|
|
64
70
|
window_rect (Optional[WindowRect]): Initial window dimensions and position.
|
|
65
71
|
If None, browser defaults are used.
|
|
72
|
+
cdp_versioned_packages_paths (Optional[Mapping[int, PATH_TYPEHINT]]): Custom local paths for specific CDP versions packages.
|
|
73
|
+
ignore_cdp_version_package_missing (bool): Whether to ignore missing CDP package errors.
|
|
66
74
|
"""
|
|
67
75
|
|
|
68
76
|
BlinkBaseMixin.__init__(
|
|
@@ -79,6 +87,8 @@ class EdgeBaseMixin(UnifiedEdgeBaseMixin, BlinkBaseMixin, AbstractEdgeBaseMixin)
|
|
|
79
87
|
page_load_timeout=page_load_timeout,
|
|
80
88
|
script_timeout=script_timeout,
|
|
81
89
|
window_rect=window_rect,
|
|
90
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
91
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
82
92
|
)
|
|
83
93
|
|
|
84
94
|
UnifiedEdgeBaseMixin.__init__(
|
|
@@ -95,6 +105,8 @@ class EdgeBaseMixin(UnifiedEdgeBaseMixin, BlinkBaseMixin, AbstractEdgeBaseMixin)
|
|
|
95
105
|
page_load_timeout=page_load_timeout,
|
|
96
106
|
script_timeout=script_timeout,
|
|
97
107
|
window_rect=window_rect,
|
|
108
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
109
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
98
110
|
)
|
|
99
111
|
|
|
100
112
|
@property
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
from typing import Optional, Type
|
|
2
1
|
from osn_selenium.models import WindowRect
|
|
2
|
+
from typing import (
|
|
3
|
+
Mapping,
|
|
4
|
+
Optional,
|
|
5
|
+
Type
|
|
6
|
+
)
|
|
3
7
|
from osn_selenium._typehints import PATH_TYPEHINT
|
|
4
8
|
from osn_selenium.flags.models.yandex import YandexFlags
|
|
5
9
|
from osn_selenium.flags.yandex import YandexFlagsManager
|
|
@@ -35,7 +39,34 @@ class YandexWebDriver(
|
|
|
35
39
|
page_load_timeout: int = 5,
|
|
36
40
|
script_timeout: int = 5,
|
|
37
41
|
window_rect: Optional[WindowRect] = None,
|
|
42
|
+
cdp_versioned_packages_paths: Optional[Mapping[int, PATH_TYPEHINT]] = None,
|
|
43
|
+
ignore_cdp_version_package_missing: bool = True,
|
|
38
44
|
):
|
|
45
|
+
"""
|
|
46
|
+
Initializes the synchronous Yandex WebDriver with specified configuration.
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
webdriver_path (str): Path to the YandexDriver executable.
|
|
50
|
+
flags_manager_type (Type[YandexFlagsManager]): The class type used for managing Yandex flags.
|
|
51
|
+
Defaults to YandexFlagsManager.
|
|
52
|
+
use_browser_exe (bool): Whether to use a specific browser executable path or auto-detect.
|
|
53
|
+
Defaults to True.
|
|
54
|
+
browser_name_in_system (str): The name of the browser in the system registry or path.
|
|
55
|
+
Defaults to "Yandex".
|
|
56
|
+
browser_exe (Optional[PATH_TYPEHINT]): Explicit path to the Yandex browser executable.
|
|
57
|
+
If None, it may be auto-detected based on other parameters.
|
|
58
|
+
flags (Optional[YandexFlags]): Initial set of flags to configure the Yandex instance.
|
|
59
|
+
start_page_url (str): The URL to navigate to immediately upon startup.
|
|
60
|
+
Defaults to "about:blank".
|
|
61
|
+
implicitly_wait (int): Default implicit wait time in seconds. Defaults to 5.
|
|
62
|
+
page_load_timeout (int): Default page load timeout in seconds. Defaults to 5.
|
|
63
|
+
script_timeout (int): Default script execution timeout in seconds. Defaults to 5.
|
|
64
|
+
window_rect (Optional[WindowRect]): Initial window dimensions and position.
|
|
65
|
+
If None, browser defaults are used.
|
|
66
|
+
cdp_versioned_packages_paths (Optional[Mapping[int, PATH_TYPEHINT]]): Custom local paths for specific CDP versions packages.
|
|
67
|
+
ignore_cdp_version_package_missing (bool): Whether to ignore missing CDP package errors.
|
|
68
|
+
"""
|
|
69
|
+
|
|
39
70
|
ChromeWebDriver.__init__(
|
|
40
71
|
self,
|
|
41
72
|
browser_exe=browser_exe,
|
|
@@ -48,6 +79,8 @@ class YandexWebDriver(
|
|
|
48
79
|
page_load_timeout=page_load_timeout,
|
|
49
80
|
script_timeout=script_timeout,
|
|
50
81
|
window_rect=window_rect,
|
|
82
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
83
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
51
84
|
)
|
|
52
85
|
|
|
53
86
|
YandexBaseMixin.__init__(
|
|
@@ -64,4 +97,6 @@ class YandexWebDriver(
|
|
|
64
97
|
page_load_timeout=page_load_timeout,
|
|
65
98
|
script_timeout=script_timeout,
|
|
66
99
|
window_rect=window_rect,
|
|
100
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
101
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
67
102
|
)
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
from typing import Optional, Type
|
|
2
1
|
from osn_selenium.models import WindowRect
|
|
2
|
+
from typing import (
|
|
3
|
+
Mapping,
|
|
4
|
+
Optional,
|
|
5
|
+
Type
|
|
6
|
+
)
|
|
3
7
|
from osn_selenium.flags.models.yandex import YandexFlags
|
|
4
8
|
from osn_selenium.flags.yandex import YandexFlagsManager
|
|
5
9
|
from osn_selenium.webdrivers.sync.chrome.base import ChromeBaseMixin
|
|
@@ -41,6 +45,8 @@ class YandexBaseMixin(UnifiedYandexBaseMixin, ChromeBaseMixin, AbstractYandexBas
|
|
|
41
45
|
page_load_timeout: int = 5,
|
|
42
46
|
script_timeout: int = 5,
|
|
43
47
|
window_rect: Optional[WindowRect] = None,
|
|
48
|
+
cdp_versioned_packages_paths: Optional[Mapping[int, PATH_TYPEHINT]] = None,
|
|
49
|
+
ignore_cdp_version_package_missing: bool = True,
|
|
44
50
|
):
|
|
45
51
|
"""
|
|
46
52
|
Initializes the synchronous Yandex WebDriver mixin with specified configuration.
|
|
@@ -64,6 +70,8 @@ class YandexBaseMixin(UnifiedYandexBaseMixin, ChromeBaseMixin, AbstractYandexBas
|
|
|
64
70
|
script_timeout (int): Default script execution timeout in seconds. Defaults to 5.
|
|
65
71
|
window_rect (Optional[WindowRect]): Initial window dimensions and position.
|
|
66
72
|
If None, browser defaults are used.
|
|
73
|
+
cdp_versioned_packages_paths (Optional[Mapping[int, PATH_TYPEHINT]]): Custom local paths for specific CDP versions packages.
|
|
74
|
+
ignore_cdp_version_package_missing (bool): Whether to ignore missing CDP package errors.
|
|
67
75
|
"""
|
|
68
76
|
|
|
69
77
|
ChromeBaseMixin.__init__(
|
|
@@ -80,6 +88,8 @@ class YandexBaseMixin(UnifiedYandexBaseMixin, ChromeBaseMixin, AbstractYandexBas
|
|
|
80
88
|
page_load_timeout=page_load_timeout,
|
|
81
89
|
script_timeout=script_timeout,
|
|
82
90
|
window_rect=window_rect,
|
|
91
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
92
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
83
93
|
)
|
|
84
94
|
|
|
85
95
|
UnifiedYandexBaseMixin.__init__(
|
|
@@ -96,4 +106,6 @@ class YandexBaseMixin(UnifiedYandexBaseMixin, ChromeBaseMixin, AbstractYandexBas
|
|
|
96
106
|
page_load_timeout=page_load_timeout,
|
|
97
107
|
script_timeout=script_timeout,
|
|
98
108
|
window_rect=window_rect,
|
|
109
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
110
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
99
111
|
)
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import trio
|
|
2
|
-
from typing import Optional, Type
|
|
3
2
|
from osn_selenium.models import WindowRect
|
|
3
|
+
from typing import (
|
|
4
|
+
Mapping,
|
|
5
|
+
Optional,
|
|
6
|
+
Type
|
|
7
|
+
)
|
|
4
8
|
from osn_selenium._typehints import PATH_TYPEHINT
|
|
5
9
|
from osn_selenium.flags.blink import BlinkFlagsManager
|
|
6
10
|
from osn_selenium.flags.models.blink import BlinkFlags
|
|
@@ -54,6 +58,8 @@ class BlinkWebDriver(
|
|
|
54
58
|
window_rect: Optional[WindowRect] = None,
|
|
55
59
|
devtools_settings: Optional[DevToolsSettings] = None,
|
|
56
60
|
capacity_limiter: Optional[trio.CapacityLimiter] = None,
|
|
61
|
+
cdp_versioned_packages_paths: Optional[Mapping[int, PATH_TYPEHINT]] = None,
|
|
62
|
+
ignore_cdp_version_package_missing: bool = True,
|
|
57
63
|
):
|
|
58
64
|
"""
|
|
59
65
|
Initializes the BlinkWebDriver instance.
|
|
@@ -104,6 +110,8 @@ class BlinkWebDriver(
|
|
|
104
110
|
window_rect=window_rect,
|
|
105
111
|
devtools_settings=devtools_settings,
|
|
106
112
|
capacity_limiter=capacity_limiter,
|
|
113
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
114
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
107
115
|
)
|
|
108
116
|
|
|
109
117
|
BlinkBaseMixin.__init__(
|
|
@@ -121,4 +129,6 @@ class BlinkWebDriver(
|
|
|
121
129
|
script_timeout=script_timeout,
|
|
122
130
|
window_rect=window_rect,
|
|
123
131
|
capacity_limiter=capacity_limiter,
|
|
132
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
133
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
124
134
|
)
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import trio
|
|
2
2
|
import pathlib
|
|
3
|
-
from typing import Optional, Type
|
|
4
3
|
from osn_selenium.models import WindowRect
|
|
4
|
+
from typing import (
|
|
5
|
+
Mapping,
|
|
6
|
+
Optional,
|
|
7
|
+
Type
|
|
8
|
+
)
|
|
5
9
|
from osn_selenium.flags.blink import BlinkFlagsManager
|
|
6
10
|
from osn_selenium.flags.models.blink import BlinkFlags
|
|
7
11
|
from osn_selenium.webdrivers.trio_threads.core.base import CoreBaseMixin
|
|
@@ -47,6 +51,8 @@ class BlinkBaseMixin(UnifiedBlinkBaseMixin, CoreBaseMixin, AbstractBlinkBaseMixi
|
|
|
47
51
|
script_timeout: int = 5,
|
|
48
52
|
window_rect: Optional[WindowRect] = None,
|
|
49
53
|
capacity_limiter: Optional[trio.CapacityLimiter] = None,
|
|
54
|
+
cdp_versioned_packages_paths: Optional[Mapping[int, PATH_TYPEHINT]] = None,
|
|
55
|
+
ignore_cdp_version_package_missing: bool = True,
|
|
50
56
|
):
|
|
51
57
|
"""
|
|
52
58
|
Initializes the BlinkWebDriver instance.
|
|
@@ -83,6 +89,8 @@ class BlinkBaseMixin(UnifiedBlinkBaseMixin, CoreBaseMixin, AbstractBlinkBaseMixi
|
|
|
83
89
|
the browser's default window size will be used. Defaults to None.
|
|
84
90
|
capacity_limiter (Optional[trio.CapacityLimiter]): A Trio capacity limiter used to
|
|
85
91
|
throttle concurrent thread-based operations. Defaults to None.
|
|
92
|
+
cdp_versioned_packages_paths (Optional[Mapping[int, PATH_TYPEHINT]]): Custom local paths for specific CDP versions packages.
|
|
93
|
+
ignore_cdp_version_package_missing (bool): Whether to ignore missing CDP package errors.
|
|
86
94
|
"""
|
|
87
95
|
|
|
88
96
|
CoreBaseMixin.__init__(
|
|
@@ -95,6 +103,8 @@ class BlinkBaseMixin(UnifiedBlinkBaseMixin, CoreBaseMixin, AbstractBlinkBaseMixi
|
|
|
95
103
|
script_timeout=script_timeout,
|
|
96
104
|
window_rect=window_rect,
|
|
97
105
|
capacity_limiter=capacity_limiter,
|
|
106
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
107
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
98
108
|
)
|
|
99
109
|
|
|
100
110
|
UnifiedBlinkBaseMixin.__init__(
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import trio
|
|
2
|
-
from typing import Optional, Type
|
|
3
2
|
from osn_selenium.models import WindowRect
|
|
3
|
+
from typing import (
|
|
4
|
+
Mapping,
|
|
5
|
+
Optional,
|
|
6
|
+
Type
|
|
7
|
+
)
|
|
4
8
|
from osn_selenium._typehints import PATH_TYPEHINT
|
|
5
9
|
from osn_selenium.flags.chrome import ChromeFlagsManager
|
|
6
10
|
from osn_selenium.flags.models.chrome import ChromeFlags
|
|
@@ -46,7 +50,32 @@ class ChromeWebDriver(
|
|
|
46
50
|
window_rect: Optional[WindowRect] = None,
|
|
47
51
|
devtools_settings: Optional[DevToolsSettings] = None,
|
|
48
52
|
capacity_limiter: Optional[trio.CapacityLimiter] = None,
|
|
53
|
+
cdp_versioned_packages_paths: Optional[Mapping[int, PATH_TYPEHINT]] = None,
|
|
54
|
+
ignore_cdp_version_package_missing: bool = True,
|
|
49
55
|
):
|
|
56
|
+
"""
|
|
57
|
+
Initializes the Trio-based Chrome WebDriver with specified configuration.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
webdriver_path (str): Path to the ChromeDriver executable.
|
|
61
|
+
flags_manager_type (Type[ChromeFlagsManager]): The class type used for managing Chrome flags.
|
|
62
|
+
Defaults to ChromeFlagsManager.
|
|
63
|
+
use_browser_exe (bool): Whether to use a specific browser executable path or auto-detect.
|
|
64
|
+
Defaults to True.
|
|
65
|
+
browser_name_in_system (str): The name of the browser in the system registry or path.
|
|
66
|
+
Defaults to "Google Chrome".
|
|
67
|
+
browser_exe (Optional[PATH_TYPEHINT]): Explicit path to the Chrome browser executable.
|
|
68
|
+
flags (Optional[ChromeFlags]): Initial set of flags.
|
|
69
|
+
start_page_url (str): The initial URL. Defaults to "about:blank".
|
|
70
|
+
implicitly_wait (int): Default implicit wait time.
|
|
71
|
+
page_load_timeout (int): Default page load timeout.
|
|
72
|
+
script_timeout (int): Default script timeout.
|
|
73
|
+
window_rect (Optional[WindowRect]): Initial window dimensions.
|
|
74
|
+
capacity_limiter (Optional[trio.CapacityLimiter]): Trio capacity limiter.
|
|
75
|
+
cdp_versioned_packages_paths (Optional[Mapping[int, PATH_TYPEHINT]]): Custom local paths for specific CDP versions packages.
|
|
76
|
+
ignore_cdp_version_package_missing (bool): Whether to ignore missing CDP package errors.
|
|
77
|
+
"""
|
|
78
|
+
|
|
50
79
|
BlinkWebDriver.__init__(
|
|
51
80
|
self,
|
|
52
81
|
browser_exe=browser_exe,
|
|
@@ -61,6 +90,8 @@ class ChromeWebDriver(
|
|
|
61
90
|
window_rect=window_rect,
|
|
62
91
|
devtools_settings=devtools_settings,
|
|
63
92
|
capacity_limiter=capacity_limiter,
|
|
93
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
94
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
64
95
|
)
|
|
65
96
|
|
|
66
97
|
ChromeBaseMixin.__init__(
|
|
@@ -78,4 +109,6 @@ class ChromeWebDriver(
|
|
|
78
109
|
script_timeout=script_timeout,
|
|
79
110
|
window_rect=window_rect,
|
|
80
111
|
capacity_limiter=capacity_limiter,
|
|
112
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
113
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
81
114
|
)
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import trio
|
|
2
|
-
from typing import Optional, Type
|
|
3
2
|
from osn_selenium.models import WindowRect
|
|
3
|
+
from typing import (
|
|
4
|
+
Mapping,
|
|
5
|
+
Optional,
|
|
6
|
+
Type
|
|
7
|
+
)
|
|
4
8
|
from osn_selenium.flags.chrome import ChromeFlagsManager
|
|
5
9
|
from osn_selenium.flags.models.chrome import ChromeFlags
|
|
6
10
|
from selenium.webdriver import (
|
|
@@ -46,9 +50,11 @@ class ChromeBaseMixin(UnifiedChromeBaseMixin, BlinkBaseMixin, AbstractChromeBase
|
|
|
46
50
|
script_timeout: int = 5,
|
|
47
51
|
window_rect: Optional[WindowRect] = None,
|
|
48
52
|
capacity_limiter: Optional[trio.CapacityLimiter] = None,
|
|
53
|
+
cdp_versioned_packages_paths: Optional[Mapping[int, PATH_TYPEHINT]] = None,
|
|
54
|
+
ignore_cdp_version_package_missing: bool = True,
|
|
49
55
|
):
|
|
50
56
|
"""
|
|
51
|
-
Initializes the Trio-based Chrome WebDriver mixin.
|
|
57
|
+
Initializes the Trio-based Chrome WebDriver mixin with specified configuration.
|
|
52
58
|
|
|
53
59
|
Args:
|
|
54
60
|
webdriver_path (str): Path to the ChromeDriver executable.
|
|
@@ -67,6 +73,8 @@ class ChromeBaseMixin(UnifiedChromeBaseMixin, BlinkBaseMixin, AbstractChromeBase
|
|
|
67
73
|
script_timeout (int): Default script timeout.
|
|
68
74
|
window_rect (Optional[WindowRect]): Initial window dimensions.
|
|
69
75
|
capacity_limiter (Optional[trio.CapacityLimiter]): Trio capacity limiter.
|
|
76
|
+
cdp_versioned_packages_paths (Optional[Mapping[int, PATH_TYPEHINT]]): Custom local paths for specific CDP versions packages.
|
|
77
|
+
ignore_cdp_version_package_missing (bool): Whether to ignore missing CDP package errors.
|
|
70
78
|
"""
|
|
71
79
|
|
|
72
80
|
BlinkBaseMixin.__init__(
|
|
@@ -84,6 +92,8 @@ class ChromeBaseMixin(UnifiedChromeBaseMixin, BlinkBaseMixin, AbstractChromeBase
|
|
|
84
92
|
script_timeout=script_timeout,
|
|
85
93
|
window_rect=window_rect,
|
|
86
94
|
capacity_limiter=capacity_limiter,
|
|
95
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
96
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
87
97
|
)
|
|
88
98
|
|
|
89
99
|
UnifiedChromeBaseMixin.__init__(
|
|
@@ -100,6 +110,8 @@ class ChromeBaseMixin(UnifiedChromeBaseMixin, BlinkBaseMixin, AbstractChromeBase
|
|
|
100
110
|
page_load_timeout=page_load_timeout,
|
|
101
111
|
script_timeout=script_timeout,
|
|
102
112
|
window_rect=window_rect,
|
|
113
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
114
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
103
115
|
)
|
|
104
116
|
|
|
105
117
|
@property
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import trio
|
|
2
|
-
from typing import Optional, Type
|
|
3
2
|
from osn_selenium.models import WindowRect
|
|
3
|
+
from typing import (
|
|
4
|
+
Mapping,
|
|
5
|
+
Optional,
|
|
6
|
+
Type
|
|
7
|
+
)
|
|
8
|
+
from osn_selenium._typehints import PATH_TYPEHINT
|
|
4
9
|
from osn_selenium.dev_tools.manager import DevTools
|
|
5
10
|
from osn_selenium.flags.base import BrowserFlagsManager
|
|
6
11
|
from osn_selenium.flags.models.base import BrowserFlags
|
|
@@ -64,13 +69,12 @@ class CoreWebDriver(
|
|
|
64
69
|
window_rect: Optional[WindowRect] = None,
|
|
65
70
|
devtools_settings: Optional[DevToolsSettings] = None,
|
|
66
71
|
capacity_limiter: Optional[trio.CapacityLimiter] = None,
|
|
72
|
+
cdp_versioned_packages_paths: Optional[Mapping[int, PATH_TYPEHINT]] = None,
|
|
73
|
+
ignore_cdp_version_package_missing: bool = True,
|
|
67
74
|
) -> None:
|
|
68
75
|
"""
|
|
69
76
|
Initializes the main WebDriver instance with Trio thread support.
|
|
70
77
|
|
|
71
|
-
Combines multiple functional mixins and initializes the JavaScript executor
|
|
72
|
-
along with base configuration components.
|
|
73
|
-
|
|
74
78
|
Args:
|
|
75
79
|
webdriver_path (str): The file path to the WebDriver executable.
|
|
76
80
|
flags_manager_type (Type[BrowserFlagsManager]): The class type used to manage
|
|
@@ -100,6 +104,8 @@ class CoreWebDriver(
|
|
|
100
104
|
script_timeout=script_timeout,
|
|
101
105
|
window_rect=window_rect,
|
|
102
106
|
capacity_limiter=capacity_limiter,
|
|
107
|
+
cdp_versioned_packages_paths=cdp_versioned_packages_paths,
|
|
108
|
+
ignore_cdp_version_package_missing=ignore_cdp_version_package_missing,
|
|
103
109
|
)
|
|
104
110
|
|
|
105
111
|
self._devtools = DevTools(parent_webdriver=self, devtools_settings=devtools_settings)
|
|
@@ -3,7 +3,7 @@ from typing import (
|
|
|
3
3
|
List,
|
|
4
4
|
Optional
|
|
5
5
|
)
|
|
6
|
-
from osn_selenium.
|
|
6
|
+
from osn_selenium.trio_threads_mixin import TrioThreadMixin
|
|
7
7
|
from osn_selenium._typehints import DEVICES_TYPEHINT
|
|
8
8
|
from osn_selenium.webdrivers._bridges import (
|
|
9
9
|
get_js_executor_bridge
|