seleniumbase 4.36.0__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.
- seleniumbase/__version__.py +1 -1
- seleniumbase/core/browser_launcher.py +11 -1
- seleniumbase/core/sb_cdp.py +6 -0
- seleniumbase/undetected/__init__.py +6 -2
- seleniumbase/undetected/cdp_driver/tab.py +36 -4
- {seleniumbase-4.36.0.dist-info → seleniumbase-4.36.1.dist-info}/METADATA +1 -1
- {seleniumbase-4.36.0.dist-info → seleniumbase-4.36.1.dist-info}/RECORD +11 -11
- {seleniumbase-4.36.0.dist-info → seleniumbase-4.36.1.dist-info}/WHEEL +0 -0
- {seleniumbase-4.36.0.dist-info → seleniumbase-4.36.1.dist-info}/entry_points.txt +0 -0
- {seleniumbase-4.36.0.dist-info → seleniumbase-4.36.1.dist-info}/licenses/LICENSE +0 -0
- {seleniumbase-4.36.0.dist-info → seleniumbase-4.36.1.dist-info}/top_level.txt +0 -0
seleniumbase/__version__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
# seleniumbase package
|
2
|
-
__version__ = "4.36.
|
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)
|
@@ -2125,6 +2127,15 @@ def _set_chrome_options(
|
|
2125
2127
|
prefs["enable_do_not_track"] = True
|
2126
2128
|
if external_pdf:
|
2127
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)
|
2128
2139
|
if proxy_string or proxy_pac_url:
|
2129
2140
|
# Implementation of https://stackoverflow.com/q/65705775/7058266
|
2130
2141
|
prefs["webrtc.ip_handling_policy"] = "disable_non_proxied_udp"
|
@@ -3299,7 +3310,6 @@ def get_remote_driver(
|
|
3299
3310
|
from seleniumbase.core import capabilities_parser
|
3300
3311
|
desired_caps = capabilities_parser.get_desired_capabilities(cap_file)
|
3301
3312
|
if cap_string:
|
3302
|
-
import json
|
3303
3313
|
try:
|
3304
3314
|
extra_caps = json.loads(str(cap_string))
|
3305
3315
|
except Exception as e:
|
seleniumbase/core/sb_cdp.py
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
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)
|
@@ -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=
|
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=
|
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=
|
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=
|
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=
|
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.36.
|
139
|
-
seleniumbase-4.36.
|
140
|
-
seleniumbase-4.36.
|
141
|
-
seleniumbase-4.36.
|
142
|
-
seleniumbase-4.36.
|
143
|
-
seleniumbase-4.36.
|
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,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|