seleniumbase 4.43.0__py3-none-any.whl → 4.43.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.
Potentially problematic release.
This version of seleniumbase might be problematic. Click here for more details.
- seleniumbase/__version__.py +1 -1
- seleniumbase/behave/behave_sb.py +7 -8
- seleniumbase/console_scripts/sb_caseplans.py +3 -4
- seleniumbase/console_scripts/sb_mkchart.py +1 -2
- seleniumbase/console_scripts/sb_mkdir.py +21 -22
- seleniumbase/console_scripts/sb_mkfile.py +1 -2
- seleniumbase/console_scripts/sb_mkpres.py +1 -2
- seleniumbase/console_scripts/sb_mkrec.py +1 -2
- seleniumbase/console_scripts/sb_objectify.py +4 -5
- seleniumbase/console_scripts/sb_print.py +1 -1
- seleniumbase/core/browser_launcher.py +14 -3
- seleniumbase/core/detect_b_ver.py +214 -8
- seleniumbase/core/log_helper.py +4 -5
- seleniumbase/core/report_helper.py +6 -5
- seleniumbase/core/sb_cdp.py +17 -2
- seleniumbase/core/tour_helper.py +1 -2
- seleniumbase/fixtures/base_case.py +23 -24
- seleniumbase/fixtures/constants.py +11 -0
- seleniumbase/fixtures/js_utils.py +14 -2
- seleniumbase/fixtures/page_actions.py +1 -2
- seleniumbase/fixtures/page_utils.py +15 -10
- seleniumbase/plugins/basic_test_info.py +2 -3
- seleniumbase/plugins/page_source.py +2 -3
- seleniumbase/plugins/pytest_plugin.py +23 -20
- seleniumbase/translate/translator.py +2 -3
- seleniumbase/undetected/cdp_driver/cdp_util.py +42 -38
- seleniumbase/undetected/cdp_driver/connection.py +1 -2
- seleniumbase/utilities/selenium_grid/download_selenium_server.py +1 -1
- seleniumbase/utilities/selenium_grid/grid_hub.py +1 -2
- seleniumbase/utilities/selenium_grid/grid_node.py +2 -3
- seleniumbase/utilities/selenium_ide/convert_ide.py +2 -3
- {seleniumbase-4.43.0.dist-info → seleniumbase-4.43.2.dist-info}/METADATA +4 -3
- {seleniumbase-4.43.0.dist-info → seleniumbase-4.43.2.dist-info}/RECORD +37 -37
- {seleniumbase-4.43.0.dist-info → seleniumbase-4.43.2.dist-info}/WHEEL +0 -0
- {seleniumbase-4.43.0.dist-info → seleniumbase-4.43.2.dist-info}/entry_points.txt +0 -0
- {seleniumbase-4.43.0.dist-info → seleniumbase-4.43.2.dist-info}/licenses/LICENSE +0 -0
- {seleniumbase-4.43.0.dist-info → seleniumbase-4.43.2.dist-info}/top_level.txt +0 -0
|
@@ -1269,10 +1269,16 @@ def scroll_to_element(driver, element):
|
|
|
1269
1269
|
return False
|
|
1270
1270
|
try:
|
|
1271
1271
|
element_location_x = element.location["x"]
|
|
1272
|
+
except Exception:
|
|
1273
|
+
element_location_x = 0
|
|
1274
|
+
try:
|
|
1272
1275
|
element_width = element.size["width"]
|
|
1276
|
+
except Exception:
|
|
1277
|
+
element_width = 0
|
|
1278
|
+
try:
|
|
1273
1279
|
screen_width = driver.get_window_size()["width"]
|
|
1274
1280
|
except Exception:
|
|
1275
|
-
|
|
1281
|
+
screen_width = execute_script("return window.innerWidth;")
|
|
1276
1282
|
element_location_y = element_location_y - constants.Scroll.Y_OFFSET
|
|
1277
1283
|
if element_location_y < 0:
|
|
1278
1284
|
element_location_y = 0
|
|
@@ -1312,10 +1318,16 @@ def slow_scroll_to_element(driver, element, *args, **kwargs):
|
|
|
1312
1318
|
return
|
|
1313
1319
|
try:
|
|
1314
1320
|
element_location_x = element.location["x"]
|
|
1321
|
+
except Exception:
|
|
1322
|
+
element_location_x = 0
|
|
1323
|
+
try:
|
|
1315
1324
|
element_width = element.size["width"]
|
|
1325
|
+
except Exception:
|
|
1326
|
+
element_width = 0
|
|
1327
|
+
try:
|
|
1316
1328
|
screen_width = driver.get_window_size()["width"]
|
|
1317
1329
|
except Exception:
|
|
1318
|
-
|
|
1330
|
+
screen_width = execute_script("return window.innerWidth;")
|
|
1319
1331
|
element_location_y = element_location_y - constants.Scroll.Y_OFFSET
|
|
1320
1332
|
if element_location_y < 0:
|
|
1321
1333
|
element_location_y = 0
|
|
@@ -17,7 +17,6 @@ By.XPATH # "xpath"
|
|
|
17
17
|
By.TAG_NAME # "tag name"
|
|
18
18
|
By.PARTIAL_LINK_TEXT # "partial link text"
|
|
19
19
|
"""
|
|
20
|
-
import codecs
|
|
21
20
|
import os
|
|
22
21
|
import time
|
|
23
22
|
from contextlib import suppress
|
|
@@ -1531,7 +1530,7 @@ def save_page_source(driver, name, folder=None):
|
|
|
1531
1530
|
rendered_source = log_helper.get_html_source_with_base_href(
|
|
1532
1531
|
driver, page_source
|
|
1533
1532
|
)
|
|
1534
|
-
html_file =
|
|
1533
|
+
html_file = open(html_file_path, "w+", "utf-8")
|
|
1535
1534
|
html_file.write(rendered_source)
|
|
1536
1535
|
html_file.close()
|
|
1537
1536
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"""This module contains useful utility methods"""
|
|
2
|
-
import codecs
|
|
3
2
|
import fasteners
|
|
4
3
|
import os
|
|
5
4
|
import re
|
|
@@ -110,10 +109,10 @@ def looks_like_a_page_url(url):
|
|
|
110
109
|
navigate to the page if a URL is detected, but will instead call
|
|
111
110
|
self.get_element(URL_AS_A_SELECTOR) if the input is not a URL."""
|
|
112
111
|
return url.startswith((
|
|
113
|
-
"http:", "https:", "://", "about:", "blob:", "chrome:",
|
|
112
|
+
"http:", "https:", "://", "about:", "blob:", "chrome:", "opera:",
|
|
114
113
|
"data:", "edge:", "file:", "view-source:", "chrome-search:",
|
|
115
114
|
"chrome-extension:", "chrome-untrusted:", "isolated-app:",
|
|
116
|
-
"chrome-devtools:", "devtools:"
|
|
115
|
+
"chrome-devtools:", "devtools:", "brave:", "comet:", "atlas:"
|
|
117
116
|
))
|
|
118
117
|
|
|
119
118
|
|
|
@@ -305,7 +304,7 @@ def _download_file_to(file_url, destination_folder, new_file_name=None):
|
|
|
305
304
|
constants.MultiBrowser.DOWNLOAD_FILE_LOCK
|
|
306
305
|
)
|
|
307
306
|
with download_file_lock:
|
|
308
|
-
with open(file_path, "wb") as code:
|
|
307
|
+
with open(file_path, mode="wb") as code:
|
|
309
308
|
code.write(r.content)
|
|
310
309
|
|
|
311
310
|
|
|
@@ -314,8 +313,10 @@ def _save_data_as(data, destination_folder, file_name):
|
|
|
314
313
|
constants.MultiBrowser.FILE_IO_LOCK
|
|
315
314
|
)
|
|
316
315
|
with file_io_lock:
|
|
317
|
-
out_file =
|
|
318
|
-
os.path.join(destination_folder, file_name),
|
|
316
|
+
out_file = open(
|
|
317
|
+
os.path.join(destination_folder, file_name),
|
|
318
|
+
mode="w+",
|
|
319
|
+
encoding="utf-8",
|
|
319
320
|
)
|
|
320
321
|
out_file.writelines(data)
|
|
321
322
|
out_file.close()
|
|
@@ -328,12 +329,16 @@ def _append_data_to_file(data, destination_folder, file_name):
|
|
|
328
329
|
with file_io_lock:
|
|
329
330
|
existing_data = ""
|
|
330
331
|
if os.path.exists(os.path.join(destination_folder, file_name)):
|
|
331
|
-
with open(
|
|
332
|
+
with open(
|
|
333
|
+
os.path.join(destination_folder, file_name), mode="r"
|
|
334
|
+
) as f:
|
|
332
335
|
existing_data = f.read()
|
|
333
336
|
if not existing_data.split("\n")[-1] == "":
|
|
334
337
|
existing_data += "\n"
|
|
335
|
-
out_file =
|
|
336
|
-
os.path.join(destination_folder, file_name),
|
|
338
|
+
out_file = open(
|
|
339
|
+
os.path.join(destination_folder, file_name),
|
|
340
|
+
mode="w+",
|
|
341
|
+
encoding="utf-8",
|
|
337
342
|
)
|
|
338
343
|
out_file.writelines("%s%s" % (existing_data, data))
|
|
339
344
|
out_file.close()
|
|
@@ -346,7 +351,7 @@ def _get_file_data(folder, file_name):
|
|
|
346
351
|
with file_io_lock:
|
|
347
352
|
if not os.path.exists(os.path.join(folder, file_name)):
|
|
348
353
|
raise Exception("File not found!")
|
|
349
|
-
with open(os.path.join(folder, file_name), "r") as f:
|
|
354
|
+
with open(os.path.join(folder, file_name), mode="r") as f:
|
|
350
355
|
data = f.read()
|
|
351
356
|
return data
|
|
352
357
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"""Test Info Plugin for SeleniumBase tests that run with pynose / nosetests"""
|
|
2
2
|
import os
|
|
3
|
-
import codecs
|
|
4
3
|
import time
|
|
5
4
|
import traceback
|
|
6
5
|
from nose.plugins import Plugin
|
|
@@ -26,7 +25,7 @@ class BasicTestInfo(Plugin):
|
|
|
26
25
|
if not os.path.exists(test_logpath):
|
|
27
26
|
os.makedirs(test_logpath)
|
|
28
27
|
file_name = "%s/%s" % (test_logpath, self.logfile_name)
|
|
29
|
-
basic_info_file =
|
|
28
|
+
basic_info_file = open(file_name, mode="w+", encoding="utf-8")
|
|
30
29
|
self.__log_test_error_data(basic_info_file, test, err, "Error")
|
|
31
30
|
basic_info_file.close()
|
|
32
31
|
|
|
@@ -35,7 +34,7 @@ class BasicTestInfo(Plugin):
|
|
|
35
34
|
if not os.path.exists(test_logpath):
|
|
36
35
|
os.makedirs(test_logpath)
|
|
37
36
|
file_name = "%s/%s" % (test_logpath, self.logfile_name)
|
|
38
|
-
basic_info_file =
|
|
37
|
+
basic_info_file = open(file_name, mode="w+", encoding="utf-8")
|
|
39
38
|
self.__log_test_error_data(basic_info_file, test, err, "Error")
|
|
40
39
|
basic_info_file.close()
|
|
41
40
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"""PageSource Plugin for SeleniumBase tests that run with pynose / nosetests"""
|
|
2
2
|
import os
|
|
3
|
-
import codecs
|
|
4
3
|
from nose.plugins import Plugin
|
|
5
4
|
from seleniumbase.config import settings
|
|
6
5
|
from seleniumbase.core import log_helper
|
|
@@ -29,7 +28,7 @@ class PageSource(Plugin):
|
|
|
29
28
|
if not os.path.exists(test_logpath):
|
|
30
29
|
os.makedirs(test_logpath)
|
|
31
30
|
html_file_name = os.path.join(test_logpath, self.logfile_name)
|
|
32
|
-
html_file =
|
|
31
|
+
html_file = open(html_file_name, mode="w+", encoding="utf-8")
|
|
33
32
|
rendered_source = log_helper.get_html_source_with_base_href(
|
|
34
33
|
test.driver, page_source
|
|
35
34
|
)
|
|
@@ -45,7 +44,7 @@ class PageSource(Plugin):
|
|
|
45
44
|
if not os.path.exists(test_logpath):
|
|
46
45
|
os.makedirs(test_logpath)
|
|
47
46
|
html_file_name = os.path.join(test_logpath, self.logfile_name)
|
|
48
|
-
html_file =
|
|
47
|
+
html_file = open(html_file_name, mode="w+", encoding="utf-8")
|
|
49
48
|
rendered_source = log_helper.get_html_source_with_base_href(
|
|
50
49
|
test.driver, page_source
|
|
51
50
|
)
|
|
@@ -1898,7 +1898,6 @@ def _get_test_ids_(the_item):
|
|
|
1898
1898
|
|
|
1899
1899
|
|
|
1900
1900
|
def _create_dashboard_assets_():
|
|
1901
|
-
import codecs
|
|
1902
1901
|
from seleniumbase.js_code.live_js import live_js
|
|
1903
1902
|
from seleniumbase.core.style_sheet import get_pytest_style
|
|
1904
1903
|
|
|
@@ -1911,24 +1910,24 @@ def _create_dashboard_assets_():
|
|
|
1911
1910
|
add_pytest_style_css = True
|
|
1912
1911
|
if os.path.exists(pytest_style_css):
|
|
1913
1912
|
existing_pytest_style = None
|
|
1914
|
-
with open(pytest_style_css, "r") as f:
|
|
1913
|
+
with open(pytest_style_css, mode="r") as f:
|
|
1915
1914
|
existing_pytest_style = f.read()
|
|
1916
1915
|
if existing_pytest_style == get_pytest_style():
|
|
1917
1916
|
add_pytest_style_css = False
|
|
1918
1917
|
if add_pytest_style_css:
|
|
1919
|
-
out_file =
|
|
1918
|
+
out_file = open(pytest_style_css, mode="w+", encoding="utf-8")
|
|
1920
1919
|
out_file.writelines(get_pytest_style())
|
|
1921
1920
|
out_file.close()
|
|
1922
1921
|
live_js_file = os.path.join(assets_folder, "live.js")
|
|
1923
1922
|
add_live_js_file = True
|
|
1924
1923
|
if os.path.exists(live_js_file):
|
|
1925
1924
|
existing_live_js = None
|
|
1926
|
-
with open(live_js_file, "r") as f:
|
|
1925
|
+
with open(live_js_file, mode="r") as f:
|
|
1927
1926
|
existing_live_js = f.read()
|
|
1928
1927
|
if existing_live_js == live_js:
|
|
1929
1928
|
add_live_js_file = False
|
|
1930
1929
|
if add_live_js_file:
|
|
1931
|
-
out_file =
|
|
1930
|
+
out_file = open(live_js_file, mode="w+", encoding="utf-8")
|
|
1932
1931
|
out_file.writelines(live_js)
|
|
1933
1932
|
out_file.close()
|
|
1934
1933
|
|
|
@@ -2229,7 +2228,7 @@ def _perform_pytest_unconfigure_(config):
|
|
|
2229
2228
|
and html_report_path
|
|
2230
2229
|
and os.path.exists(html_report_path)
|
|
2231
2230
|
):
|
|
2232
|
-
with open(html_report_path, "r", encoding="utf-8") as f:
|
|
2231
|
+
with open(html_report_path, mode="r", encoding="utf-8") as f:
|
|
2233
2232
|
the_html_r = f.read()
|
|
2234
2233
|
assets_chunk = "if (assets.length === 1) {"
|
|
2235
2234
|
remove_media = "container.classList.remove('media-container')"
|
|
@@ -2275,18 +2274,18 @@ def _perform_pytest_unconfigure_(config):
|
|
|
2275
2274
|
the_html_r = (
|
|
2276
2275
|
the_html_r[:rc_loc] + new_time + the_html_r[end_rc_loc:]
|
|
2277
2276
|
)
|
|
2278
|
-
with open(html_report_path, "w", encoding="utf-8") as f:
|
|
2277
|
+
with open(html_report_path, mode="w", encoding="utf-8") as f:
|
|
2279
2278
|
f.write(the_html_r) # Finalize the HTML report
|
|
2280
2279
|
with suppress(Exception):
|
|
2281
2280
|
shared_utils.make_writable(html_report_path)
|
|
2282
|
-
with open(html_report_path_copy, "w", encoding="utf-8") as f:
|
|
2281
|
+
with open(html_report_path_copy, mode="w", encoding="utf-8") as f:
|
|
2283
2282
|
f.write(the_html_r) # Finalize the HTML report copy
|
|
2284
2283
|
with suppress(Exception):
|
|
2285
2284
|
shared_utils.make_writable(html_report_path_copy)
|
|
2286
2285
|
assets_style = "./assets/style.css"
|
|
2287
2286
|
if os.path.exists(assets_style):
|
|
2288
2287
|
html_style = None
|
|
2289
|
-
with open(assets_style, "r", encoding="utf-8") as f:
|
|
2288
|
+
with open(assets_style, mode="r", encoding="utf-8") as f:
|
|
2290
2289
|
html_style = f.read()
|
|
2291
2290
|
if html_style:
|
|
2292
2291
|
html_style = html_style.replace("top: -50px;", "top: 2px;")
|
|
@@ -2298,7 +2297,7 @@ def _perform_pytest_unconfigure_(config):
|
|
|
2298
2297
|
html_style = html_style.replace(".collapsible", ".oldc")
|
|
2299
2298
|
html_style = html_style.replace(" (hide details)", "")
|
|
2300
2299
|
html_style = html_style.replace(" (show details)", "")
|
|
2301
|
-
with open(assets_style, "w", encoding="utf-8") as f:
|
|
2300
|
+
with open(assets_style, mode="w", encoding="utf-8") as f:
|
|
2302
2301
|
f.write(html_style)
|
|
2303
2302
|
with suppress(Exception):
|
|
2304
2303
|
shared_utils.make_writable(assets_style)
|
|
@@ -2333,7 +2332,7 @@ def _perform_pytest_unconfigure_(config):
|
|
|
2333
2332
|
# Part 1: Finalizing the dashboard / integrating html report
|
|
2334
2333
|
if os.path.exists(dashboard_path):
|
|
2335
2334
|
the_html_d = None
|
|
2336
|
-
with open(dashboard_path, "r", encoding="utf-8") as f:
|
|
2335
|
+
with open(dashboard_path, mode="r", encoding="utf-8") as f:
|
|
2337
2336
|
the_html_d = f.read()
|
|
2338
2337
|
if sb_config._multithreaded and "-c" in sys_argv:
|
|
2339
2338
|
# Threads have "-c" in sys.argv, except for the last
|
|
@@ -2344,7 +2343,7 @@ def _perform_pytest_unconfigure_(config):
|
|
|
2344
2343
|
if os.path.exists(pie_path):
|
|
2345
2344
|
import json
|
|
2346
2345
|
|
|
2347
|
-
with open(pie_path, "r") as f:
|
|
2346
|
+
with open(pie_path, mode="r") as f:
|
|
2348
2347
|
dash_pie = f.read().strip()
|
|
2349
2348
|
sb_config._saved_dashboard_pie = json.loads(dash_pie)
|
|
2350
2349
|
# If the test run doesn't complete by itself, stop refresh
|
|
@@ -2375,20 +2374,20 @@ def _perform_pytest_unconfigure_(config):
|
|
|
2375
2374
|
if sb_config._dash_final_summary:
|
|
2376
2375
|
the_html_d += sb_config._dash_final_summary
|
|
2377
2376
|
time.sleep(0.1) # Add time for "livejs" to detect changes
|
|
2378
|
-
with open(dashboard_path, "w", encoding="utf-8") as f:
|
|
2377
|
+
with open(dashboard_path, mode="w", encoding="utf-8") as f:
|
|
2379
2378
|
f.write(the_html_d) # Finalize the dashboard
|
|
2380
2379
|
time.sleep(0.1) # Add time for "livejs" to detect changes
|
|
2381
2380
|
the_html_d = the_html_d.replace(
|
|
2382
2381
|
"</head>", "</head><!-- Dashboard Report Done -->"
|
|
2383
2382
|
)
|
|
2384
|
-
with open(dashboard_path, "w", encoding="utf-8") as f:
|
|
2383
|
+
with open(dashboard_path, mode="w", encoding="utf-8") as f:
|
|
2385
2384
|
f.write(the_html_d) # Finalize the dashboard
|
|
2386
2385
|
with suppress(Exception):
|
|
2387
2386
|
shared_utils.make_writable(dashboard_path)
|
|
2388
2387
|
assets_style = "./assets/style.css"
|
|
2389
2388
|
if os.path.exists(assets_style):
|
|
2390
2389
|
html_style = None
|
|
2391
|
-
with open(assets_style, "r", encoding="utf-8") as f:
|
|
2390
|
+
with open(assets_style, mode="r", encoding="utf-8") as f:
|
|
2392
2391
|
html_style = f.read()
|
|
2393
2392
|
if html_style:
|
|
2394
2393
|
html_style = html_style.replace("top: -50px;", "top: 2px;")
|
|
@@ -2400,7 +2399,7 @@ def _perform_pytest_unconfigure_(config):
|
|
|
2400
2399
|
html_style = html_style.replace(".collapsible", ".oldc")
|
|
2401
2400
|
html_style = html_style.replace(" (hide details)", "")
|
|
2402
2401
|
html_style = html_style.replace(" (show details)", "")
|
|
2403
|
-
with open(assets_style, "w", encoding="utf-8") as f:
|
|
2402
|
+
with open(assets_style, mode="w", encoding="utf-8") as f:
|
|
2404
2403
|
f.write(html_style)
|
|
2405
2404
|
with suppress(Exception):
|
|
2406
2405
|
shared_utils.make_writable(assets_style)
|
|
@@ -2422,7 +2421,7 @@ def _perform_pytest_unconfigure_(config):
|
|
|
2422
2421
|
):
|
|
2423
2422
|
# Add the dashboard pie to the pytest html report
|
|
2424
2423
|
the_html_r = None
|
|
2425
|
-
with open(html_report_path, "r", encoding="utf-8") as f:
|
|
2424
|
+
with open(html_report_path, mode="r", encoding="utf-8") as f:
|
|
2426
2425
|
the_html_r = f.read()
|
|
2427
2426
|
if sb_config._saved_dashboard_pie:
|
|
2428
2427
|
h_r_name = sb_config._html_report_name
|
|
@@ -2485,11 +2484,13 @@ def _perform_pytest_unconfigure_(config):
|
|
|
2485
2484
|
the_html_r = (
|
|
2486
2485
|
the_html_r[:rc_loc] + new_time + the_html_r[end_rc_loc:]
|
|
2487
2486
|
)
|
|
2488
|
-
with open(html_report_path, "w", encoding="utf-8") as f:
|
|
2487
|
+
with open(html_report_path, mode="w", encoding="utf-8") as f:
|
|
2489
2488
|
f.write(the_html_r) # Finalize the HTML report
|
|
2490
2489
|
with suppress(Exception):
|
|
2491
2490
|
shared_utils.make_writable(html_report_path)
|
|
2492
|
-
with open(
|
|
2491
|
+
with open(
|
|
2492
|
+
html_report_path_copy, mode="w", encoding="utf-8"
|
|
2493
|
+
) as f:
|
|
2493
2494
|
f.write(the_html_r) # Finalize the HTML report copy
|
|
2494
2495
|
with suppress(Exception):
|
|
2495
2496
|
shared_utils.make_writable(html_report_path_copy)
|
|
@@ -2534,7 +2535,9 @@ def pytest_unconfigure(config):
|
|
|
2534
2535
|
):
|
|
2535
2536
|
# Dash is HTML Report (Multithreaded)
|
|
2536
2537
|
sb_config._dash_is_html_report = True
|
|
2537
|
-
with open(
|
|
2538
|
+
with open(
|
|
2539
|
+
dashboard_path, mode="w", encoding="utf-8"
|
|
2540
|
+
) as f:
|
|
2538
2541
|
f.write(sb_config._dash_html)
|
|
2539
2542
|
# Dashboard Multithreaded
|
|
2540
2543
|
_perform_pytest_unconfigure_(config)
|
|
@@ -27,7 +27,6 @@ Output:
|
|
|
27
27
|
(Example: Translating "test_1.py" into Japanese with
|
|
28
28
|
"-c" will create a new file called "test_1_ja.py".)
|
|
29
29
|
"""
|
|
30
|
-
import codecs
|
|
31
30
|
import colorama
|
|
32
31
|
import os
|
|
33
32
|
import re
|
|
@@ -485,7 +484,7 @@ def main():
|
|
|
485
484
|
print("")
|
|
486
485
|
raise Exception(message)
|
|
487
486
|
|
|
488
|
-
with open(seleniumbase_file, "r", encoding="utf-8") as f:
|
|
487
|
+
with open(seleniumbase_file, mode="r", encoding="utf-8") as f:
|
|
489
488
|
all_code = f.read()
|
|
490
489
|
if "def test_" not in all_code and "from seleniumbase" not in all_code:
|
|
491
490
|
print("")
|
|
@@ -1043,7 +1042,7 @@ def main():
|
|
|
1043
1042
|
pass # Print-only run already done
|
|
1044
1043
|
|
|
1045
1044
|
if new_file_name:
|
|
1046
|
-
out_file =
|
|
1045
|
+
out_file = open(new_file_name, mode="w+", encoding="utf-8")
|
|
1047
1046
|
out_file.writelines("\r\n".join(seleniumbase_lines))
|
|
1048
1047
|
out_file.close()
|
|
1049
1048
|
results_saved = (
|
|
@@ -554,11 +554,45 @@ async def start(
|
|
|
554
554
|
ad_block_dir = os.path.join(DOWNLOADS_FOLDER, "ad_block")
|
|
555
555
|
__unzip_to_new_folder(ad_block_zip, ad_block_dir)
|
|
556
556
|
extension_dir = __add_chrome_ext_dir(extension_dir, ad_block_dir)
|
|
557
|
-
if
|
|
558
|
-
"binary_location" in kwargs
|
|
559
|
-
and not browser_executable_path
|
|
560
|
-
):
|
|
557
|
+
if "binary_location" in kwargs and not browser_executable_path:
|
|
561
558
|
browser_executable_path = kwargs["binary_location"]
|
|
559
|
+
if not browser_executable_path:
|
|
560
|
+
browser = None
|
|
561
|
+
if "browser" in kwargs:
|
|
562
|
+
browser = kwargs["browser"]
|
|
563
|
+
if not browser and "--browser" in arg_join:
|
|
564
|
+
br_string = None
|
|
565
|
+
if "--browser=" in arg_join:
|
|
566
|
+
br_string = arg_join.split("--browser=")[1].split(" ")[0]
|
|
567
|
+
elif "--browser " in arg_join:
|
|
568
|
+
br_string = arg_join.split("--browser ")[1].split(" ")[0]
|
|
569
|
+
if br_string:
|
|
570
|
+
if br_string.startswith('"') and br_string.endswith('"'):
|
|
571
|
+
br_string = proxy_string[1:-1]
|
|
572
|
+
elif br_string.startswith("'") and br_string.endswith("'"):
|
|
573
|
+
br_string = proxy_string[1:-1]
|
|
574
|
+
browser = br_string
|
|
575
|
+
if not browser:
|
|
576
|
+
if "--edge" in sys_argv:
|
|
577
|
+
browser = "edge"
|
|
578
|
+
elif "--opera" in sys_argv:
|
|
579
|
+
browser = "opera"
|
|
580
|
+
elif "--brave" in sys_argv:
|
|
581
|
+
browser = "brave"
|
|
582
|
+
elif "--comet" in sys_argv:
|
|
583
|
+
browser = "comet"
|
|
584
|
+
elif "--atlas" in sys_argv:
|
|
585
|
+
browser = "atlas"
|
|
586
|
+
else:
|
|
587
|
+
browser = "chrome"
|
|
588
|
+
sb_config._cdp_browser = browser
|
|
589
|
+
if browser == "comet" or browser == "atlas":
|
|
590
|
+
incognito = False
|
|
591
|
+
guest = False
|
|
592
|
+
with suppress(Exception):
|
|
593
|
+
browser_binary = detect_b_ver.get_binary_location(browser)
|
|
594
|
+
if browser_binary and os.path.exists(browser_binary):
|
|
595
|
+
browser_executable_path = browser_binary
|
|
562
596
|
if not config:
|
|
563
597
|
config = Config(
|
|
564
598
|
user_data_dir,
|
|
@@ -622,23 +656,8 @@ async def start(
|
|
|
622
656
|
|
|
623
657
|
|
|
624
658
|
async def start_async(*args, **kwargs) -> Browser:
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
if "browser_executable_path" in kwargs:
|
|
628
|
-
binary_location = kwargs["browser_executable_path"]
|
|
629
|
-
if binary_location and isinstance(binary_location, str):
|
|
630
|
-
binary_location = binary_location.strip()
|
|
631
|
-
else:
|
|
632
|
-
binary_location = detect_b_ver.get_binary_location("google-chrome")
|
|
633
|
-
if binary_location and isinstance(binary_location, str):
|
|
634
|
-
binary_location = binary_location.strip()
|
|
635
|
-
if not os.path.exists(binary_location):
|
|
636
|
-
binary_location = None
|
|
637
|
-
if (
|
|
638
|
-
shared_utils.is_chrome_130_or_newer(binary_location)
|
|
639
|
-
and "user_data_dir" in kwargs
|
|
640
|
-
and kwargs["user_data_dir"]
|
|
641
|
-
):
|
|
659
|
+
if "user_data_dir" in kwargs and kwargs["user_data_dir"]:
|
|
660
|
+
headless = False
|
|
642
661
|
if "headless" in kwargs:
|
|
643
662
|
headless = kwargs["headless"]
|
|
644
663
|
decoy_args = kwargs
|
|
@@ -662,23 +681,8 @@ def start_sync(*args, **kwargs) -> Browser:
|
|
|
662
681
|
loop = kwargs["loop"]
|
|
663
682
|
else:
|
|
664
683
|
loop = asyncio.new_event_loop()
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
if "browser_executable_path" in kwargs:
|
|
668
|
-
binary_location = kwargs["browser_executable_path"]
|
|
669
|
-
if binary_location and isinstance(binary_location, str):
|
|
670
|
-
binary_location = binary_location.strip()
|
|
671
|
-
else:
|
|
672
|
-
binary_location = detect_b_ver.get_binary_location("google-chrome")
|
|
673
|
-
if binary_location and isinstance(binary_location, str):
|
|
674
|
-
binary_location = binary_location.strip()
|
|
675
|
-
if not os.path.exists(binary_location):
|
|
676
|
-
binary_location = None
|
|
677
|
-
if (
|
|
678
|
-
shared_utils.is_chrome_130_or_newer(binary_location)
|
|
679
|
-
and "user_data_dir" in kwargs
|
|
680
|
-
and kwargs["user_data_dir"]
|
|
681
|
-
):
|
|
684
|
+
if "user_data_dir" in kwargs and kwargs["user_data_dir"]:
|
|
685
|
+
headless = False
|
|
682
686
|
if "headless" in kwargs:
|
|
683
687
|
headless = kwargs["headless"]
|
|
684
688
|
decoy_args = kwargs
|
|
@@ -33,6 +33,7 @@ GLOBAL_DELAY = 0.005
|
|
|
33
33
|
MAX_SIZE: int = 2**28
|
|
34
34
|
PING_TIMEOUT: int = 1800 # 30 minutes
|
|
35
35
|
TargetType = Union[cdp.target.TargetInfo, cdp.target.TargetID]
|
|
36
|
+
logging.getLogger("asyncio").setLevel(logging.CRITICAL)
|
|
36
37
|
logger = logging.getLogger("uc.connection")
|
|
37
38
|
|
|
38
39
|
|
|
@@ -520,8 +521,6 @@ class Connection(metaclass=CantTouchThis):
|
|
|
520
521
|
except BaseException:
|
|
521
522
|
logger.debug("NOT GOOD", exc_info=True)
|
|
522
523
|
continue
|
|
523
|
-
finally:
|
|
524
|
-
continue
|
|
525
524
|
for ed in enabled_domains:
|
|
526
525
|
# Items still present at this point are unused and need removal.
|
|
527
526
|
self.enabled_domains.remove(ed)
|
|
@@ -19,7 +19,7 @@ FULL_DOWNLOAD_PATH = os.getcwd() + "/" + RENAMED_JAR_FILE
|
|
|
19
19
|
def download_selenium_server():
|
|
20
20
|
"""Downloads the Selenium Server JAR file."""
|
|
21
21
|
try:
|
|
22
|
-
local_file = open(JAR_FILE, "wb")
|
|
22
|
+
local_file = open(JAR_FILE, mode="wb")
|
|
23
23
|
remote_file = urlopen(SELENIUM_JAR)
|
|
24
24
|
print("Downloading the Selenium Server JAR file...\n")
|
|
25
25
|
local_file.write(remote_file.read())
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import codecs
|
|
2
1
|
import os
|
|
3
2
|
import subprocess
|
|
4
3
|
import sys
|
|
@@ -78,7 +77,7 @@ def main():
|
|
|
78
77
|
data = []
|
|
79
78
|
data.append(verbose)
|
|
80
79
|
file_path = os.path.join(dir_path, "verbose_hub_server.dat")
|
|
81
|
-
file =
|
|
80
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
82
81
|
file.writelines("\r\n".join(data))
|
|
83
82
|
file.close()
|
|
84
83
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import codecs
|
|
2
1
|
import os
|
|
3
2
|
import subprocess
|
|
4
3
|
import sys
|
|
@@ -88,14 +87,14 @@ def main():
|
|
|
88
87
|
data = []
|
|
89
88
|
data.append(server_ip)
|
|
90
89
|
file_path = os.path.join(dir_path, "ip_of_grid_hub.dat")
|
|
91
|
-
file =
|
|
90
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
92
91
|
file.writelines("\r\n".join(data))
|
|
93
92
|
file.close()
|
|
94
93
|
|
|
95
94
|
data = []
|
|
96
95
|
data.append(verbose)
|
|
97
96
|
file_path = os.path.join(dir_path, "verbose_node_server.dat")
|
|
98
|
-
file =
|
|
97
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
99
98
|
file.writelines("\r\n".join(data))
|
|
100
99
|
file.close()
|
|
101
100
|
|
|
@@ -8,7 +8,6 @@ Usage:
|
|
|
8
8
|
Output:
|
|
9
9
|
[NEW_FILE_SB].py (adds "_SB" to the original file name)
|
|
10
10
|
(the original file is kept intact)"""
|
|
11
|
-
import codecs
|
|
12
11
|
import re
|
|
13
12
|
import sys
|
|
14
13
|
from seleniumbase.fixtures import js_utils
|
|
@@ -60,7 +59,7 @@ def main():
|
|
|
60
59
|
uses_keys = False
|
|
61
60
|
uses_select = False
|
|
62
61
|
|
|
63
|
-
with open(webdriver_python_file, "r", encoding="utf-8") as f:
|
|
62
|
+
with open(webdriver_python_file, mode="r", encoding="utf-8") as f:
|
|
64
63
|
all_code = f.read()
|
|
65
64
|
if "def test_" not in all_code:
|
|
66
65
|
raise Exception(
|
|
@@ -894,7 +893,7 @@ def main():
|
|
|
894
893
|
# Create SeleniumBase test file
|
|
895
894
|
base_file_name = webdriver_python_file.split(".py")[0]
|
|
896
895
|
converted_file_name = base_file_name + "_SB.py"
|
|
897
|
-
out_file =
|
|
896
|
+
out_file = open(converted_file_name, mode="w+", encoding="utf-8")
|
|
898
897
|
out_file.writelines(seleniumbase_code)
|
|
899
898
|
out_file.close()
|
|
900
899
|
print(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: seleniumbase
|
|
3
|
-
Version: 4.43.
|
|
3
|
+
Version: 4.43.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
|
|
@@ -94,7 +94,7 @@ Requires-Dist: pyyaml>=6.0.3
|
|
|
94
94
|
Requires-Dist: pygments>=2.19.2
|
|
95
95
|
Requires-Dist: pyreadline3>=3.5.4; platform_system == "Windows"
|
|
96
96
|
Requires-Dist: tabcompleter>=1.4.0
|
|
97
|
-
Requires-Dist: pdbp>=1.
|
|
97
|
+
Requires-Dist: pdbp>=1.8.0
|
|
98
98
|
Requires-Dist: idna>=3.11
|
|
99
99
|
Requires-Dist: chardet==5.2.0
|
|
100
100
|
Requires-Dist: charset-normalizer<4,>=3.4.4
|
|
@@ -118,7 +118,8 @@ Requires-Dist: cssselect==1.2.0; python_version < "3.9"
|
|
|
118
118
|
Requires-Dist: cssselect==1.3.0; python_version >= "3.9"
|
|
119
119
|
Requires-Dist: sortedcontainers==2.4.0
|
|
120
120
|
Requires-Dist: execnet==2.1.1
|
|
121
|
-
Requires-Dist: iniconfig==2.1.0
|
|
121
|
+
Requires-Dist: iniconfig==2.1.0; python_version < "3.10"
|
|
122
|
+
Requires-Dist: iniconfig==2.3.0; python_version >= "3.10"
|
|
122
123
|
Requires-Dist: pluggy==1.5.0; python_version < "3.9"
|
|
123
124
|
Requires-Dist: pluggy==1.6.0; python_version >= "3.9"
|
|
124
125
|
Requires-Dist: pytest==8.3.5; python_version < "3.9"
|