seleniumbase 4.35.7__py3-none-any.whl → 4.36.1__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.
@@ -1,2 +1,2 @@
1
1
  # seleniumbase package
2
- __version__ = "4.35.7"
2
+ __version__ = "4.36.1"
@@ -1,4 +1,5 @@
1
1
  import fasteners
2
+ import json
2
3
  import logging
3
4
  import os
4
5
  import platform
@@ -769,6 +770,7 @@ def uc_open_with_cdp_mode(driver, url=None):
769
770
  cdp.scroll_up = CDPM.scroll_up
770
771
  cdp.scroll_down = CDPM.scroll_down
771
772
  cdp.save_screenshot = CDPM.save_screenshot
773
+ cdp.print_to_pdf = CDPM.print_to_pdf
772
774
  cdp.page = page # async world
773
775
  cdp.driver = driver.cdp_base # async world
774
776
  cdp.tab = cdp.page # shortcut (original)
@@ -1302,6 +1304,8 @@ def _uc_gui_click_captcha(
1302
1304
  frame = "body > div#check > div:not([class])"
1303
1305
  elif driver.is_element_present(".cf-turnstile-wrapper"):
1304
1306
  frame = ".cf-turnstile-wrapper"
1307
+ elif driver.is_element_present('[class="cf-turnstile"]'):
1308
+ frame = '[class="cf-turnstile"]'
1305
1309
  elif driver.is_element_present(
1306
1310
  '[data-callback="onCaptchaSuccess"]'
1307
1311
  ):
@@ -1617,6 +1621,10 @@ def _uc_gui_handle_captcha_(driver, frame="iframe", ctype=None):
1617
1621
  )
1618
1622
  ):
1619
1623
  frame = "body > div#check > div:not([class])"
1624
+ elif driver.is_element_present(".cf-turnstile-wrapper"):
1625
+ frame = ".cf-turnstile-wrapper"
1626
+ elif driver.is_element_present('[class="cf-turnstile"]'):
1627
+ frame = '[class="cf-turnstile"]'
1620
1628
  else:
1621
1629
  return
1622
1630
  else:
@@ -2119,6 +2127,15 @@ def _set_chrome_options(
2119
2127
  prefs["enable_do_not_track"] = True
2120
2128
  if external_pdf:
2121
2129
  prefs["plugins.always_open_pdf_externally"] = True
2130
+ pdf_settings = {
2131
+ "recentDestinations": [
2132
+ {"id": "Save as PDF", "origin": "local", "account": ""}
2133
+ ],
2134
+ "selectedDestinationId": "Save as PDF",
2135
+ "version": 2,
2136
+ }
2137
+ app_state = "printing.print_preview_sticky_settings.appState"
2138
+ prefs[app_state] = json.dumps(pdf_settings)
2122
2139
  if proxy_string or proxy_pac_url:
2123
2140
  # Implementation of https://stackoverflow.com/q/65705775/7058266
2124
2141
  prefs["webrtc.ip_handling_policy"] = "disable_non_proxied_udp"
@@ -3293,7 +3310,6 @@ def get_remote_driver(
3293
3310
  from seleniumbase.core import capabilities_parser
3294
3311
  desired_caps = capabilities_parser.get_desired_capabilities(cap_file)
3295
3312
  if cap_string:
3296
- import json
3297
3313
  try:
3298
3314
  extra_caps = json.loads(str(cap_string))
3299
3315
  except Exception as e:
@@ -2181,6 +2181,12 @@ class CDPMethods():
2181
2181
  else:
2182
2182
  self.select(selector).save_screenshot(filename)
2183
2183
 
2184
+ def print_to_pdf(self, name, folder=None):
2185
+ filename = name
2186
+ if folder:
2187
+ filename = os.path.join(folder, name)
2188
+ self.loop.run_until_complete(self.page.print_to_pdf(filename))
2189
+
2184
2190
 
2185
2191
  class Chrome(CDPMethods):
2186
2192
  def __init__(self, url=None, **kwargs):
@@ -459,7 +459,9 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
459
459
  if self.current_url.startswith(
460
460
  "chrome-extension://"
461
461
  ):
462
- self.close()
462
+ # https://issues.chromium.org/issues/396611138
463
+ # (Uncomment below when resolved)
464
+ # self.close()
463
465
  if self.service.is_connectable():
464
466
  self.stop_client()
465
467
  self.service.stop()
@@ -496,7 +498,9 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
496
498
  if self.current_url.startswith(
497
499
  "chrome-extension://"
498
500
  ):
499
- self.close()
501
+ # https://issues.chromium.org/issues/396611138
502
+ # (Uncomment below when resolved)
503
+ # self.close()
500
504
  if self.service.is_connectable():
501
505
  self.stop_client()
502
506
  self.service.stop()
@@ -1,7 +1,10 @@
1
1
  from __future__ import annotations
2
2
  import asyncio
3
+ import base64
4
+ import datetime
3
5
  import logging
4
6
  import pathlib
7
+ import urllib.parse
5
8
  import warnings
6
9
  from typing import Dict, List, Union, Optional, Tuple
7
10
  from . import browser as cdp_browser
@@ -1133,9 +1136,6 @@ class Tab(Connection):
1133
1136
  :return: The path/filename of the saved screenshot.
1134
1137
  :rtype: str
1135
1138
  """
1136
- import urllib.parse
1137
- import datetime
1138
-
1139
1139
  await self.sleep() # Update the target's URL
1140
1140
  path = None
1141
1141
  if format.lower() in ["jpg", "jpeg"]:
@@ -1166,8 +1166,40 @@ class Tab(Connection):
1166
1166
  "Most possible cause is the page "
1167
1167
  "has not finished loading yet."
1168
1168
  )
1169
- import base64
1169
+ data_bytes = base64.b64decode(data)
1170
+ if not path:
1171
+ raise RuntimeError("Invalid filename or path: '%s'" % filename)
1172
+ path.write_bytes(data_bytes)
1173
+ return str(path)
1170
1174
 
1175
+ async def print_to_pdf(
1176
+ self,
1177
+ filename: Optional[PathLike] = "auto",
1178
+ ) -> str:
1179
+ """
1180
+ Saves a webpage as a PDF.
1181
+ :param filename: uses this as the save path
1182
+ :type filename: PathLike
1183
+ :return: The path/filename of the saved screenshot.
1184
+ :rtype: str
1185
+ """
1186
+ await self.sleep() # Update the target's URL
1187
+ path = None
1188
+ ext = ".pdf"
1189
+ if not filename or filename == "auto":
1190
+ parsed = urllib.parse.urlparse(self.target.url)
1191
+ parts = parsed.path.split("/")
1192
+ last_part = parts[-1]
1193
+ last_part = last_part.rsplit("?", 1)[0]
1194
+ dt_str = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
1195
+ candidate = f"{parsed.hostname}__{last_part}_{dt_str}"
1196
+ path = pathlib.Path(candidate + ext) # noqa
1197
+ else:
1198
+ path = pathlib.Path(filename)
1199
+ path.parent.mkdir(parents=True, exist_ok=True)
1200
+ data, _ = await self.send(cdp.page.print_to_pdf())
1201
+ if not data:
1202
+ raise ProtocolException("Could not save PDF.")
1171
1203
  data_bytes = base64.b64decode(data)
1172
1204
  if not path:
1173
1205
  raise RuntimeError("Invalid filename or path: '%s'" % filename)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: seleniumbase
3
- Version: 4.35.7
3
+ Version: 4.36.1
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,19 +62,20 @@ 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>=76.0.0; python_version >= "3.10"
65
+ Requires-Dist: setuptools>=77.0.3; python_version >= "3.10"
66
66
  Requires-Dist: wheel>=0.45.1
67
- Requires-Dist: attrs>=25.1.0
67
+ Requires-Dist: attrs>=25.3.0
68
68
  Requires-Dist: certifi>=2025.1.31
69
69
  Requires-Dist: exceptiongroup>=1.2.2
70
70
  Requires-Dist: websockets~=13.1; python_version < "3.9"
71
71
  Requires-Dist: websockets>=15.0.1; python_version >= "3.9"
72
72
  Requires-Dist: filelock~=3.16.1; python_version < "3.9"
73
- Requires-Dist: filelock>=3.17.0; python_version >= "3.9"
73
+ Requires-Dist: filelock>=3.18.0; python_version >= "3.9"
74
74
  Requires-Dist: fasteners>=0.19
75
75
  Requires-Dist: mycdp>=1.1.1
76
76
  Requires-Dist: pynose>=1.5.4
77
- Requires-Dist: platformdirs>=4.3.6
77
+ Requires-Dist: platformdirs>=4.3.6; python_version < "3.9"
78
+ Requires-Dist: platformdirs>=4.3.7; python_version >= "3.9"
78
79
  Requires-Dist: typing-extensions>=4.12.2
79
80
  Requires-Dist: sbvirtualdisplay>=1.4.0
80
81
  Requires-Dist: MarkupSafe==2.1.5; python_version < "3.9"
@@ -104,12 +105,12 @@ Requires-Dist: trio-websocket==0.12.2
104
105
  Requires-Dist: wsproto==1.2.0
105
106
  Requires-Dist: websocket-client==1.8.0
106
107
  Requires-Dist: selenium==4.27.1; python_version < "3.9"
107
- Requires-Dist: selenium==4.29.0; python_version >= "3.9"
108
+ Requires-Dist: selenium==4.30.0; python_version >= "3.9"
108
109
  Requires-Dist: cssselect==1.2.0; python_version < "3.9"
109
110
  Requires-Dist: cssselect==1.3.0; python_version >= "3.9"
110
111
  Requires-Dist: sortedcontainers==2.4.0
111
112
  Requires-Dist: execnet==2.1.1
112
- Requires-Dist: iniconfig==2.0.0
113
+ Requires-Dist: iniconfig==2.1.0
113
114
  Requires-Dist: pluggy==1.5.0
114
115
  Requires-Dist: pytest==8.3.5
115
116
  Requires-Dist: pytest-html==4.0.2
@@ -133,7 +134,7 @@ Requires-Dist: allure-python-commons>=2.13.5; extra == "allure"
133
134
  Requires-Dist: allure-behave>=2.13.5; extra == "allure"
134
135
  Provides-Extra: coverage
135
136
  Requires-Dist: coverage>=7.6.1; python_version < "3.9" and extra == "coverage"
136
- Requires-Dist: coverage>=7.6.12; python_version >= "3.9" and extra == "coverage"
137
+ Requires-Dist: coverage>=7.7.1; python_version >= "3.9" and extra == "coverage"
137
138
  Requires-Dist: pytest-cov>=5.0.0; python_version < "3.9" and extra == "coverage"
138
139
  Requires-Dist: pytest-cov>=6.0.0; python_version >= "3.9" and extra == "coverage"
139
140
  Provides-Extra: flake8
@@ -186,6 +187,7 @@ Dynamic: classifier
186
187
  Dynamic: home-page
187
188
  Dynamic: keywords
188
189
  Dynamic: license
190
+ Dynamic: license-file
189
191
  Dynamic: maintainer
190
192
  Dynamic: platform
191
193
  Dynamic: provides-extra
@@ -248,9 +250,7 @@ Dynamic: summary
248
250
  <br />
249
251
  </p>
250
252
 
251
- <p align="center"><a href="https://trendshift.io/repositories/12493" target="_blank"><img src="https://trendshift.io/api/badge/repositories/12493" alt="seleniumbase%2FSeleniumBase | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a></p>
252
-
253
- <p>SeleniumBase is the professional toolkit for web automation. Built for testing websites, bypassing CAPTCHAs, completing tasks, and scaling your business.</p>
253
+ <p>SeleniumBase is the professional toolkit for web automation activities. Built for testing websites, bypassing CAPTCHAs, enhancing productivity, completing tasks, and scaling your business.</p>
254
254
 
255
255
  --------
256
256
 
@@ -3,7 +3,7 @@ sbase/__main__.py,sha256=G0bVB1-DM4PGwQ1KyOupaWCs4ePbChZNNWuX2htim5U,647
3
3
  sbase/steps.py,sha256=_WvAjydKqZfTdnZW9LPKkRty-g-lfdUPmLqnZj6ulcs,43013
4
4
  seleniumbase/__init__.py,sha256=JFEY9P5QJqsa1M6ghzLMH2eIPQyh85iglCaQwg8Y8z4,2498
5
5
  seleniumbase/__main__.py,sha256=dn1p6dgCchmcH1zzTzzQvFwwdQQqnTGH6ULV9m4hv24,654
6
- seleniumbase/__version__.py,sha256=2g_cMybJdzQUUg-Rv9MQSXKu_EOLpRJPRUOLws8LJ54,46
6
+ seleniumbase/__version__.py,sha256=YQgxEdz-yaSHeBbdbR5IDhKw8U0R8ygphayfDm_O-7c,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=xOHybb7tdhQRS4-2FNyT6cdnbdMczKQS7PBvgOu72ws,238964
39
+ seleniumbase/core/browser_launcher.py,sha256=03_IFgsO1jBqFF2NeUouL5iMK0DlpwbZY_OKuwW7iYA,239734
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=qfbPDXOXmOaMaCu5QXqOvTPXJjnsWmvndBoOUTqC0vY,85218
53
+ seleniumbase/core/sb_cdp.py,sha256=UfcqmGevQog10xKUxJ8k735EDxBJgFTrpPcXjO7Popw,85430
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
@@ -106,7 +106,7 @@ seleniumbase/translate/portuguese.py,sha256=x3P4qxp56UiI41GoaL7JbUvFRYsgXU1EKjTg
106
106
  seleniumbase/translate/russian.py,sha256=TyN9n0b4GRWDEYnHRGw1rfNAscdDmP3F3Y3aySM3C7s,27978
107
107
  seleniumbase/translate/spanish.py,sha256=hh3xgW1Pq122SHYVvJAxFaXhFrjniOVncVbJbfWqOUM,25528
108
108
  seleniumbase/translate/translator.py,sha256=wPhZH6e5NhmebYL1kP2eGxUcVy1gfTb6XCH8ATEPpxE,49238
109
- seleniumbase/undetected/__init__.py,sha256=6_pKZZQFqudtng4IleiwVXvLnUibFgFOrIISq2IGbc0,24377
109
+ seleniumbase/undetected/__init__.py,sha256=_UHa3Y5CN8eDH53KjVXlo9c0kK4v1LYqK_FIti8hBd8,24627
110
110
  seleniumbase/undetected/cdp.py,sha256=RLpwZnhUvmK9tgXcZIBBQedwk2q7Jj_EXZkmzI8WUqk,4023
111
111
  seleniumbase/undetected/dprocess.py,sha256=83EV8ZHJWHG1TSUv9JNClBhdgiBXlkCc6mJ--HsoP3k,1681
112
112
  seleniumbase/undetected/options.py,sha256=BoNuwhrG7oOvuLvTwkvsWCF36pMkS1tHCG-XpP4_EkI,3001
@@ -120,7 +120,7 @@ seleniumbase/undetected/cdp_driver/cdp_util.py,sha256=6-0-Dq_dFAOXQ5_a58i9y93zRq
120
120
  seleniumbase/undetected/cdp_driver/config.py,sha256=t8KV1Vqa5SQRBq3-gjkHHmj9h85AplAM01asO3AWufs,12507
121
121
  seleniumbase/undetected/cdp_driver/connection.py,sha256=_ounWzQ1m3_t-zJVgOAU2RINiKphfJkw2Qbu-zIoHC0,23359
122
122
  seleniumbase/undetected/cdp_driver/element.py,sha256=FIC6v7OmumLCT-_vIc3H4oju_oBbaLpWJUJIKm2c_q4,40467
123
- seleniumbase/undetected/cdp_driver/tab.py,sha256=4fRB9OtiMx23r79a2aJKlEhCkP3E_JVGD_7EvJ3srxo,50944
123
+ seleniumbase/undetected/cdp_driver/tab.py,sha256=bxkCFKDejQ1xKsX3740RvvrYfC4OBv1mlQ4yWJM6As4,52260
124
124
  seleniumbase/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
125
125
  seleniumbase/utilities/selenium_grid/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
126
126
  seleniumbase/utilities/selenium_grid/download_selenium_server.py,sha256=ZdoInIbhtmdKCIPxxtJHhd2sqotqcNXWMYbwWrkh9O0,1727
@@ -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.7.dist-info/LICENSE,sha256=BRblZsX7HyPUjQmYTiyWr_e9tzWvmR3R4SFclM2R3W0,1085
139
- seleniumbase-4.35.7.dist-info/METADATA,sha256=-S8BkakysShn-OesLThYaKJjEvUNOddToIQ8dC07GrQ,86944
140
- seleniumbase-4.35.7.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
141
- seleniumbase-4.35.7.dist-info/entry_points.txt,sha256=CNrh2EKNaHYEhO6pP1RJyVLB99LkDDYX7TnUK8xfjqk,623
142
- seleniumbase-4.35.7.dist-info/top_level.txt,sha256=4N97aBOQ8ETCnDnokBsWb07lJfTaq3C1ZzYRxvLMxqU,19
143
- seleniumbase-4.35.7.dist-info/RECORD,,
138
+ seleniumbase-4.36.1.dist-info/licenses/LICENSE,sha256=BRblZsX7HyPUjQmYTiyWr_e9tzWvmR3R4SFclM2R3W0,1085
139
+ seleniumbase-4.36.1.dist-info/METADATA,sha256=8ecwJPQ5KzF_7zRdVr6glDudsbtC1RdB5f2zcjsyKVE,86819
140
+ seleniumbase-4.36.1.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
141
+ seleniumbase-4.36.1.dist-info/entry_points.txt,sha256=CNrh2EKNaHYEhO6pP1RJyVLB99LkDDYX7TnUK8xfjqk,623
142
+ seleniumbase-4.36.1.dist-info/top_level.txt,sha256=4N97aBOQ8ETCnDnokBsWb07lJfTaq3C1ZzYRxvLMxqU,19
143
+ seleniumbase-4.36.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (76.0.0)
2
+ Generator: setuptools (77.0.3)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5