seleniumbase 4.35.1__py3-none-any.whl → 4.35.2__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.
seleniumbase/__init__.py CHANGED
@@ -8,6 +8,7 @@ from seleniumbase.__version__ import __version__
8
8
  from seleniumbase.common import decorators # noqa
9
9
  from seleniumbase.common import encryption # noqa
10
10
  from seleniumbase.core import colored_traceback
11
+ from seleniumbase.core import sb_cdp # noqa
11
12
  from seleniumbase.core.browser_launcher import get_driver # noqa
12
13
  from seleniumbase.fixtures import js_utils # noqa
13
14
  from seleniumbase.fixtures import page_actions # noqa
@@ -18,6 +19,7 @@ from seleniumbase.masterqa.master_qa import MasterQA # noqa
18
19
  from seleniumbase.plugins.sb_manager import SB # noqa
19
20
  from seleniumbase.plugins.driver_manager import Driver # noqa
20
21
  from seleniumbase.plugins.driver_manager import DriverContext # noqa
22
+ from seleniumbase.undetected import cdp_driver # noqa
21
23
  from seleniumbase import translate # noqa
22
24
 
23
25
  with suppress(Exception):
@@ -1,2 +1,2 @@
1
1
  # seleniumbase package
2
- __version__ = "4.35.1"
2
+ __version__ = "4.35.2"
@@ -235,8 +235,12 @@ def extend_driver(driver, proxy_auth=False, use_uc=True):
235
235
  driver.reset_window_size = DM.reset_window_size
236
236
  if hasattr(driver, "proxy"):
237
237
  driver.set_wire_proxy = DM.set_wire_proxy
238
- if proxy_auth and not use_uc:
239
- time.sleep(0.11) # Proxy needs moment to load in Manifest V3
238
+ if proxy_auth:
239
+ # Proxy needs a moment to load in Manifest V3
240
+ if use_uc:
241
+ time.sleep(0.12)
242
+ else:
243
+ time.sleep(0.22)
240
244
  return driver
241
245
 
242
246
 
@@ -1,4 +1,5 @@
1
1
  """Add CDP methods to extend the driver"""
2
+ import asyncio
2
3
  import fasteners
3
4
  import os
4
5
  import re
@@ -11,6 +12,7 @@ from seleniumbase.fixtures import constants
11
12
  from seleniumbase.fixtures import js_utils
12
13
  from seleniumbase.fixtures import page_utils
13
14
  from seleniumbase.fixtures import shared_utils
15
+ from seleniumbase.undetected.cdp_driver import cdp_util
14
16
 
15
17
 
16
18
  class CDPMethods():
@@ -208,14 +210,16 @@ class CDPMethods():
208
210
  element = self.__add_sync_methods(element)
209
211
  return self.__add_sync_methods(element)
210
212
  elif (
211
- element.parent
213
+ element
214
+ and element.parent
212
215
  and tag_name in element.parent.tag_name.lower()
213
216
  and text.strip() in element.parent.text
214
217
  ):
215
218
  element = self.__add_sync_methods(element.parent)
216
219
  return self.__add_sync_methods(element)
217
220
  elif (
218
- element.parent
221
+ element
222
+ and element.parent
219
223
  and element.parent.parent
220
224
  and tag_name in element.parent.parent.tag_name.lower()
221
225
  and text.strip() in element.parent.parent.text
@@ -269,7 +273,8 @@ class CDPMethods():
269
273
  if element not in updated_elements:
270
274
  updated_elements.append(element)
271
275
  elif (
272
- element.parent
276
+ element
277
+ and element.parent
273
278
  and tag_name in element.parent.tag_name.lower()
274
279
  and text.strip() in element.parent.text
275
280
  ):
@@ -277,7 +282,8 @@ class CDPMethods():
277
282
  if element not in updated_elements:
278
283
  updated_elements.append(element)
279
284
  elif (
280
- element.parent
285
+ element
286
+ and element.parent
281
287
  and element.parent.parent
282
288
  and tag_name in element.parent.parent.tag_name.lower()
283
289
  and text.strip() in element.parent.parent.text
@@ -2093,3 +2099,13 @@ class CDPMethods():
2093
2099
  )
2094
2100
  else:
2095
2101
  self.select(selector).save_screenshot(filename)
2102
+
2103
+
2104
+ class Chrome(CDPMethods):
2105
+ def __init__(self, url=None, **kwargs):
2106
+ if not url:
2107
+ url = "about:blank"
2108
+ loop = asyncio.new_event_loop()
2109
+ driver = cdp_util.start_sync(**kwargs)
2110
+ page = loop.run_until_complete(driver.get(url))
2111
+ super().__init__(loop, page, driver)
@@ -1 +1,3 @@
1
1
  from seleniumbase.undetected.cdp_driver import cdp_util # noqa
2
+ from seleniumbase.undetected.cdp_driver.cdp_util import start_async # noqa
3
+ from seleniumbase.undetected.cdp_driver.cdp_util import start_sync # noqa
@@ -15,6 +15,7 @@ import urllib.parse
15
15
  import urllib.request
16
16
  import warnings
17
17
  from collections import defaultdict
18
+ from seleniumbase import config as sb_config
18
19
  from typing import List, Set, Tuple, Union
19
20
  import mycdp as cdp
20
21
  from . import cdp_util as util
@@ -287,6 +288,9 @@ class Browser:
287
288
  filter(lambda item: item.type_ == "page", self.targets)
288
289
  )
289
290
  # Use the tab to navigate to new url
291
+ if hasattr(sb_config, "_cdp_locale") and sb_config._cdp_locale:
292
+ await connection.send(cdp.page.navigate("about:blank"))
293
+ await connection.set_locale(sb_config._cdp_locale)
290
294
  frame_id, loader_id, *_ = await connection.send(
291
295
  cdp.page.navigate(url)
292
296
  )
@@ -232,9 +232,9 @@ async def start(
232
232
  browser_args: Optional[List[str]] = None,
233
233
  xvfb_metrics: Optional[List[str]] = None, # "Width,Height" for Linux
234
234
  sandbox: Optional[bool] = True,
235
- lang: Optional[str] = None,
236
- host: Optional[str] = None,
237
- port: Optional[int] = None,
235
+ lang: Optional[str] = None, # Set the Language Locale Code
236
+ host: Optional[str] = None, # Chrome remote-debugging-host
237
+ port: Optional[int] = None, # Chrome remote-debugging-port
238
238
  xvfb: Optional[int] = None, # Use a special virtual display on Linux
239
239
  headed: Optional[bool] = None, # Override default Xvfb mode on Linux
240
240
  expert: Optional[bool] = None, # Open up closed Shadow-root elements
@@ -320,7 +320,15 @@ async def start(
320
320
  time.sleep(0.15)
321
321
  driver = await Browser.create(config)
322
322
  if proxy and "@" in str(proxy):
323
- time.sleep(0.11)
323
+ time.sleep(0.15)
324
+ if lang:
325
+ sb_config._cdp_locale = lang
326
+ elif "locale" in kwargs:
327
+ sb_config._cdp_locale = kwargs["locale"]
328
+ elif "locale_code" in kwargs:
329
+ sb_config._cdp_locale = kwargs["locale_code"]
330
+ else:
331
+ sb_config._cdp_locale = None
324
332
  return driver
325
333
 
326
334
 
@@ -360,10 +368,7 @@ def start_sync(*args, **kwargs) -> Browser:
360
368
  ):
361
369
  loop = kwargs["loop"]
362
370
  else:
363
- try:
364
- loop = asyncio.get_event_loop()
365
- except RuntimeError:
366
- loop = asyncio.new_event_loop()
371
+ loop = asyncio.new_event_loop()
367
372
  headless = False
368
373
  binary_location = None
369
374
  if "browser_executable_path" in kwargs:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: seleniumbase
3
- Version: 4.35.1
3
+ Version: 4.35.2
4
4
  Summary: A complete web automation framework for end-to-end testing.
5
5
  Home-page: https://github.com/seleniumbase/SeleniumBase
6
6
  Author: Michael Mintz
@@ -62,7 +62,7 @@ License-File: LICENSE
62
62
  Requires-Dist: pip>=25.0.1
63
63
  Requires-Dist: packaging>=24.2
64
64
  Requires-Dist: setuptools~=70.2; python_version < "3.10"
65
- Requires-Dist: setuptools>=75.8.0; python_version >= "3.10"
65
+ Requires-Dist: setuptools>=75.8.2; python_version >= "3.10"
66
66
  Requires-Dist: wheel>=0.45.1
67
67
  Requires-Dist: attrs>=25.1.0
68
68
  Requires-Dist: certifi>=2025.1.31
@@ -100,7 +100,7 @@ Requires-Dist: h11==0.14.0
100
100
  Requires-Dist: outcome==1.3.0.post0
101
101
  Requires-Dist: trio==0.27.0; python_version < "3.9"
102
102
  Requires-Dist: trio==0.29.0; python_version >= "3.9"
103
- Requires-Dist: trio-websocket==0.12.1
103
+ Requires-Dist: trio-websocket==0.12.2
104
104
  Requires-Dist: wsproto==1.2.0
105
105
  Requires-Dist: websocket-client==1.8.0
106
106
  Requires-Dist: selenium==4.27.1; python_version < "3.9"
@@ -162,7 +162,7 @@ Requires-Dist: pip-system-certs==4.0; platform_system == "Windows" and extra ==
162
162
  Provides-Extra: proxy
163
163
  Requires-Dist: proxy.py==2.4.3; extra == "proxy"
164
164
  Provides-Extra: psutil
165
- Requires-Dist: psutil==6.0.0; extra == "psutil"
165
+ Requires-Dist: psutil==7.0.0; extra == "psutil"
166
166
  Provides-Extra: pyautogui
167
167
  Requires-Dist: PyAutoGUI==0.9.54; extra == "pyautogui"
168
168
  Provides-Extra: selenium-stealth
@@ -284,7 +284,7 @@ with SB(test=True, uc=True) as sb:
284
284
  ```python
285
285
  from seleniumbase import SB
286
286
 
287
- with SB(uc=True, test=True, locale_code="en") as sb:
287
+ with SB(uc=True, test=True, locale="en") as sb:
288
288
  url = "https://gitlab.com/users/sign_in"
289
289
  sb.activate_cdp_mode(url)
290
290
  sb.uc_gui_click_captcha()
@@ -1,9 +1,9 @@
1
1
  sbase/__init__.py,sha256=02izDj786GVBT0bpSq2Q2O8uwSxtyT09pnobZz91ML8,605
2
2
  sbase/__main__.py,sha256=G0bVB1-DM4PGwQ1KyOupaWCs4ePbChZNNWuX2htim5U,647
3
3
  sbase/steps.py,sha256=_WvAjydKqZfTdnZW9LPKkRty-g-lfdUPmLqnZj6ulcs,43013
4
- seleniumbase/__init__.py,sha256=OtJh8nGKL4xtZpw8KPqmn7Q6R-86t4cWUDyVF5MbMTo,2398
4
+ seleniumbase/__init__.py,sha256=JFEY9P5QJqsa1M6ghzLMH2eIPQyh85iglCaQwg8Y8z4,2498
5
5
  seleniumbase/__main__.py,sha256=dn1p6dgCchmcH1zzTzzQvFwwdQQqnTGH6ULV9m4hv24,654
6
- seleniumbase/__version__.py,sha256=Db8lU-34AfPk_0zWgBNe5iBhYA1JOuCwJ1W2-rdR45g,46
6
+ seleniumbase/__version__.py,sha256=P9cTVt3PVLsDI9atFloLWRPlzTGkd73niFjhDtv1sQc,46
7
7
  seleniumbase/behave/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  seleniumbase/behave/behave_helper.py,sha256=elkl8P9eLulRAioLstE9baYNM9N_PHBmAOcajX-pH_Y,24198
9
9
  seleniumbase/behave/behave_sb.py,sha256=qQF85LoohJBfrPK5ZcPi50v-pWtOrC9qcN1B3Ki_3tY,59401
@@ -36,7 +36,7 @@ seleniumbase/console_scripts/sb_print.py,sha256=tNy-bMDgwHJO3bZxMpmo9weSE8uhbH0C
36
36
  seleniumbase/console_scripts/sb_recorder.py,sha256=fnHb5-kh11Hit-E9Ha-e4QXzqLcZvtij6mb5qNd4B1Q,11032
37
37
  seleniumbase/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
38
  seleniumbase/core/application_manager.py,sha256=e_0sjtI8cjY5BNyZj1QBR0j6_oCScxGmSXYEpcYwuZE,576
39
- seleniumbase/core/browser_launcher.py,sha256=jUDL2RlOXnSDUwhQuZekgGisY11hhmMU-ftFVyM-afs,236519
39
+ seleniumbase/core/browser_launcher.py,sha256=YJsddTlS6fFo08olKsKKnUdZQxFm5mpXt8rKC7ZunKE,236579
40
40
  seleniumbase/core/capabilities_parser.py,sha256=meIS2uHapTCq2ldfNAToC7r0cKmZDRXuYNKExM1GHDY,6038
41
41
  seleniumbase/core/colored_traceback.py,sha256=DrRWfg7XEnKcgY59Xj7Jdk09H-XqHYBSUpB-DiZt6iY,2020
42
42
  seleniumbase/core/create_db_tables.sql,sha256=VWPtrdiW_HQ6yETHjqTu-VIrTwvd8I8o1NfBeaVSHpU,972
@@ -50,7 +50,7 @@ seleniumbase/core/proxy_helper.py,sha256=4VkpMwavz0fx8wcOqJ_jyBT0HIXwcxmAcpd1gjJ
50
50
  seleniumbase/core/recorder_helper.py,sha256=fNGjbapXmEsht54x1o6Igk198QdnPxDDnjUOzQxNhNQ,25055
51
51
  seleniumbase/core/report_helper.py,sha256=AIl6Qava2yW1uSzbLpJBlPlYDz0KE-rVhogh8hsGWBo,12201
52
52
  seleniumbase/core/s3_manager.py,sha256=bkeI8I4y19ebWuQG1oEZV5qJbotC6eN8vin31OCNWJk,3521
53
- seleniumbase/core/sb_cdp.py,sha256=rfMcBNGY90qfusHyTJzexWk6wHv9GTH9klQspgxENHE,81554
53
+ seleniumbase/core/sb_cdp.py,sha256=kPC9tS-cGA-Vy9-DW-yrV33q787Ml_ISET9iQX9jmnw,82049
54
54
  seleniumbase/core/sb_driver.py,sha256=yvTDRblBzG6bDX7XcLiAA6QcBelSJj_HHL_04lcfeeE,13760
55
55
  seleniumbase/core/session_helper.py,sha256=s9zD3PVZEWVzG2h81cCUskbNWLfdjC_LwwQjKptHCak,558
56
56
  seleniumbase/core/settings_parser.py,sha256=gqVohHVlE_5L5Cqe2L24uYrRzvoK-saX8E_Df7_-_3I,7609
@@ -113,10 +113,10 @@ seleniumbase/undetected/options.py,sha256=BoNuwhrG7oOvuLvTwkvsWCF36pMkS1tHCG-XpP
113
113
  seleniumbase/undetected/patcher.py,sha256=fXh99P2D9XPdYTFtsDYXk1ZUSh8Elkg-dGeMhUihmu4,11445
114
114
  seleniumbase/undetected/reactor.py,sha256=NropaXcO54pzmDq6quR27qPJxab6636H7LRAaq-o0ng,2859
115
115
  seleniumbase/undetected/webelement.py,sha256=OOpUYbEiOG52KsYYyuDW9tYLdA2SMnukvwQHUdPVn9E,1389
116
- seleniumbase/undetected/cdp_driver/__init__.py,sha256=c0TjMwPfVFyoqYOJ7PQ-Jln_L_dpN3ebHyaD-juQoM0,64
116
+ seleniumbase/undetected/cdp_driver/__init__.py,sha256=Ga9alwuaZZy4_XOShc0HjgFnNqpPdrcbjAicz5gE7a4,215
117
117
  seleniumbase/undetected/cdp_driver/_contradict.py,sha256=lP4b0h5quAy573ETn_TBbYV889cL1AuPLVInpJ0ZkiU,3183
118
- seleniumbase/undetected/cdp_driver/browser.py,sha256=ruPunmJKwE67Veh1MjSkZAF5W38FMwc32lHgy1YULho,30261
119
- seleniumbase/undetected/cdp_driver/cdp_util.py,sha256=zlYc_oTqtCSjV_T7lzPbFyJlj_78NHMxKkrpleXcfpQ,21374
118
+ seleniumbase/undetected/cdp_driver/browser.py,sha256=KOmHmmZkfKUoc7Qwkl5zxazuHhwW8foMYoZkRyTmgGk,30525
119
+ seleniumbase/undetected/cdp_driver/cdp_util.py,sha256=6-0-Dq_dFAOXQ5_a58i9y93zRqWUrjWoy6Pf_xBoveE,21648
120
120
  seleniumbase/undetected/cdp_driver/config.py,sha256=t8KV1Vqa5SQRBq3-gjkHHmj9h85AplAM01asO3AWufs,12507
121
121
  seleniumbase/undetected/cdp_driver/connection.py,sha256=sOTUGjbUqKA2hPvDcRCdqw1VQjVGJs7mbgVvzS7ldtE,23360
122
122
  seleniumbase/undetected/cdp_driver/element.py,sha256=FIC6v7OmumLCT-_vIc3H4oju_oBbaLpWJUJIKm2c_q4,40467
@@ -135,9 +135,9 @@ seleniumbase/utilities/selenium_grid/start-grid-hub.bat,sha256=Ftq-GrAKRYH2ssDPr
135
135
  seleniumbase/utilities/selenium_grid/start-grid-hub.sh,sha256=KADv0RUHONLL2_I443QFK8PryBpDmKn5Gy0s4o0vDSM,106
136
136
  seleniumbase/utilities/selenium_ide/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
137
137
  seleniumbase/utilities/selenium_ide/convert_ide.py,sha256=pZFnqEJQEKZPyNFjkLD29s2HPQgCrWW9XJWpCPhWOoM,31691
138
- seleniumbase-4.35.1.dist-info/LICENSE,sha256=BRblZsX7HyPUjQmYTiyWr_e9tzWvmR3R4SFclM2R3W0,1085
139
- seleniumbase-4.35.1.dist-info/METADATA,sha256=-RJH6DIDAyALXSl9bXjwxbJQQhMoqi0BBjtb_vTVmCI,86530
140
- seleniumbase-4.35.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
141
- seleniumbase-4.35.1.dist-info/entry_points.txt,sha256=CNrh2EKNaHYEhO6pP1RJyVLB99LkDDYX7TnUK8xfjqk,623
142
- seleniumbase-4.35.1.dist-info/top_level.txt,sha256=4N97aBOQ8ETCnDnokBsWb07lJfTaq3C1ZzYRxvLMxqU,19
143
- seleniumbase-4.35.1.dist-info/RECORD,,
138
+ seleniumbase-4.35.2.dist-info/LICENSE,sha256=BRblZsX7HyPUjQmYTiyWr_e9tzWvmR3R4SFclM2R3W0,1085
139
+ seleniumbase-4.35.2.dist-info/METADATA,sha256=QVAff0P_RE1LsQ199DwJ28P1Qjy0ZIUBJU7yzObSmUs,86525
140
+ seleniumbase-4.35.2.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
141
+ seleniumbase-4.35.2.dist-info/entry_points.txt,sha256=CNrh2EKNaHYEhO6pP1RJyVLB99LkDDYX7TnUK8xfjqk,623
142
+ seleniumbase-4.35.2.dist-info/top_level.txt,sha256=4N97aBOQ8ETCnDnokBsWb07lJfTaq3C1ZzYRxvLMxqU,19
143
+ seleniumbase-4.35.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (75.8.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5