seleniumbase 4.43.1__py3-none-any.whl → 4.43.3__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 -7
- seleniumbase/console_scripts/sb_caseplans.py +3 -3
- seleniumbase/console_scripts/sb_mkchart.py +1 -1
- seleniumbase/console_scripts/sb_mkdir.py +21 -21
- seleniumbase/console_scripts/sb_mkfile.py +1 -1
- seleniumbase/console_scripts/sb_mkpres.py +1 -1
- seleniumbase/console_scripts/sb_mkrec.py +1 -1
- seleniumbase/console_scripts/sb_objectify.py +4 -4
- seleniumbase/console_scripts/sb_print.py +1 -1
- seleniumbase/core/browser_launcher.py +82 -5
- seleniumbase/core/detect_b_ver.py +214 -8
- seleniumbase/core/log_helper.py +4 -4
- seleniumbase/core/report_helper.py +6 -4
- seleniumbase/core/sb_cdp.py +52 -6
- seleniumbase/core/tour_helper.py +1 -1
- seleniumbase/drivers/atlas_drivers/__init__.py +0 -0
- seleniumbase/drivers/brave_drivers/__init__.py +0 -0
- seleniumbase/drivers/comet_drivers/__init__.py +0 -0
- seleniumbase/drivers/opera_drivers/__init__.py +0 -0
- seleniumbase/fixtures/constants.py +29 -0
- seleniumbase/fixtures/js_utils.py +14 -2
- seleniumbase/fixtures/page_utils.py +13 -7
- seleniumbase/plugins/basic_test_info.py +2 -2
- seleniumbase/plugins/driver_manager.py +114 -0
- seleniumbase/plugins/page_source.py +2 -2
- seleniumbase/plugins/pytest_plugin.py +148 -21
- seleniumbase/plugins/sb_manager.py +118 -1
- seleniumbase/plugins/selenium_plugin.py +123 -0
- seleniumbase/translate/translator.py +2 -2
- seleniumbase/undetected/cdp_driver/cdp_util.py +56 -38
- seleniumbase/undetected/cdp_driver/connection.py +1 -0
- seleniumbase/utilities/selenium_grid/download_selenium_server.py +1 -1
- seleniumbase/utilities/selenium_grid/grid_hub.py +1 -1
- seleniumbase/utilities/selenium_grid/grid_node.py +2 -2
- seleniumbase/utilities/selenium_ide/convert_ide.py +2 -2
- {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.3.dist-info}/METADATA +6 -2
- {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.3.dist-info}/RECORD +42 -38
- {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.3.dist-info}/WHEEL +0 -0
- {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.3.dist-info}/entry_points.txt +0 -0
- {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.3.dist-info}/licenses/LICENSE +0 -0
- {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.3.dist-info}/top_level.txt +0 -0
|
@@ -267,6 +267,7 @@ def SB(
|
|
|
267
267
|
import traceback
|
|
268
268
|
from seleniumbase import config as sb_config
|
|
269
269
|
from seleniumbase.config import settings
|
|
270
|
+
from seleniumbase.core import detect_b_ver
|
|
270
271
|
from seleniumbase.fixtures import constants
|
|
271
272
|
from seleniumbase.fixtures import shared_utils
|
|
272
273
|
|
|
@@ -334,10 +335,37 @@ def SB(
|
|
|
334
335
|
raise_test_failure = True # Exit on first error or failed test.
|
|
335
336
|
else:
|
|
336
337
|
raise_test_failure = False
|
|
338
|
+
sb_config._browser_shortcut = None
|
|
339
|
+
sb_config._cdp_browser = None
|
|
340
|
+
sb_config._cdp_bin_loc = None
|
|
337
341
|
browser_changes = 0
|
|
338
342
|
browser_set = None
|
|
339
343
|
browser_text = None
|
|
340
344
|
browser_list = []
|
|
345
|
+
# Check if binary-location in options
|
|
346
|
+
bin_loc_in_options = False
|
|
347
|
+
if (
|
|
348
|
+
binary_location
|
|
349
|
+
and len(str(binary_location)) > 5
|
|
350
|
+
and os.path.exists(str(binary_location))
|
|
351
|
+
):
|
|
352
|
+
bin_loc_in_options = True
|
|
353
|
+
else:
|
|
354
|
+
for arg in sys_argv:
|
|
355
|
+
if arg in ["--binary-location", "--binary_location", "--bl"]:
|
|
356
|
+
bin_loc_in_options = True
|
|
357
|
+
if (
|
|
358
|
+
browser
|
|
359
|
+
and browser in constants.ChromiumSubs.chromium_subs
|
|
360
|
+
and not bin_loc_in_options
|
|
361
|
+
):
|
|
362
|
+
bin_loc = detect_b_ver.get_binary_location(browser)
|
|
363
|
+
if bin_loc and os.path.exists(bin_loc):
|
|
364
|
+
if browser in bin_loc.lower().split("/")[-1].split("\\")[-1]:
|
|
365
|
+
sb_config._cdp_browser = browser
|
|
366
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
367
|
+
binary_location = bin_loc
|
|
368
|
+
bin_loc_in_options = True
|
|
341
369
|
# As a shortcut, you can use "--edge" instead of "--browser=edge", etc,
|
|
342
370
|
# but you can only specify one default browser for tests. (Default: chrome)
|
|
343
371
|
if "--browser=chrome" in sys_argv or "--browser chrome" in sys_argv:
|
|
@@ -364,6 +392,46 @@ def SB(
|
|
|
364
392
|
browser_changes += 1
|
|
365
393
|
browser_set = "remote"
|
|
366
394
|
browser_list.append("--browser=remote")
|
|
395
|
+
if "--browser=opera" in sys_argv or "--browser opera" in sys_argv:
|
|
396
|
+
if not bin_loc_in_options:
|
|
397
|
+
bin_loc = detect_b_ver.get_binary_location("opera")
|
|
398
|
+
if os.path.exists(bin_loc):
|
|
399
|
+
browser_changes += 1
|
|
400
|
+
browser_set = "opera"
|
|
401
|
+
sb_config._browser_shortcut = "opera"
|
|
402
|
+
sb_config._cdp_browser = "opera"
|
|
403
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
404
|
+
browser_list.append("--browser=opera")
|
|
405
|
+
if "--browser=brave" in sys_argv or "--browser brave" in sys_argv:
|
|
406
|
+
if not bin_loc_in_options:
|
|
407
|
+
bin_loc = detect_b_ver.get_binary_location("brave")
|
|
408
|
+
if os.path.exists(bin_loc):
|
|
409
|
+
browser_changes += 1
|
|
410
|
+
browser_set = "brave"
|
|
411
|
+
sb_config._browser_shortcut = "brave"
|
|
412
|
+
sb_config._cdp_browser = "brave"
|
|
413
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
414
|
+
browser_list.append("--browser=brave")
|
|
415
|
+
if "--browser=comet" in sys_argv or "--browser comet" in sys_argv:
|
|
416
|
+
if not bin_loc_in_options:
|
|
417
|
+
bin_loc = detect_b_ver.get_binary_location("comet")
|
|
418
|
+
if os.path.exists(bin_loc):
|
|
419
|
+
browser_changes += 1
|
|
420
|
+
browser_set = "comet"
|
|
421
|
+
sb_config._browser_shortcut = "comet"
|
|
422
|
+
sb_config._cdp_browser = "comet"
|
|
423
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
424
|
+
browser_list.append("--browser=comet")
|
|
425
|
+
if "--browser=atlas" in sys_argv or "--browser atlas" in sys_argv:
|
|
426
|
+
if not bin_loc_in_options:
|
|
427
|
+
bin_loc = detect_b_ver.get_binary_location("atlas")
|
|
428
|
+
if os.path.exists(bin_loc):
|
|
429
|
+
browser_changes += 1
|
|
430
|
+
browser_set = "atlas"
|
|
431
|
+
sb_config._browser_shortcut = "atlas"
|
|
432
|
+
sb_config._cdp_browser = "atlas"
|
|
433
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
434
|
+
browser_list.append("--browser=atlas")
|
|
367
435
|
browser_text = browser_set
|
|
368
436
|
if "--chrome" in sys_argv and not browser_set == "chrome":
|
|
369
437
|
browser_changes += 1
|
|
@@ -390,6 +458,46 @@ def SB(
|
|
|
390
458
|
browser_text = "safari"
|
|
391
459
|
sb_config._browser_shortcut = "safari"
|
|
392
460
|
browser_list.append("--safari")
|
|
461
|
+
if "--opera" in sys_argv and not browser_set == "opera":
|
|
462
|
+
if not bin_loc_in_options:
|
|
463
|
+
bin_loc = detect_b_ver.get_binary_location("opera")
|
|
464
|
+
if os.path.exists(bin_loc):
|
|
465
|
+
browser_changes += 1
|
|
466
|
+
browser_text = "opera"
|
|
467
|
+
sb_config._browser_shortcut = "opera"
|
|
468
|
+
sb_config._cdp_browser = "opera"
|
|
469
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
470
|
+
browser_list.append("--opera")
|
|
471
|
+
if "--brave" in sys_argv and not browser_set == "brave":
|
|
472
|
+
if not bin_loc_in_options:
|
|
473
|
+
bin_loc = detect_b_ver.get_binary_location("brave")
|
|
474
|
+
if os.path.exists(bin_loc):
|
|
475
|
+
browser_changes += 1
|
|
476
|
+
browser_text = "brave"
|
|
477
|
+
sb_config._browser_shortcut = "brave"
|
|
478
|
+
sb_config._cdp_browser = "brave"
|
|
479
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
480
|
+
browser_list.append("--brave")
|
|
481
|
+
if "--comet" in sys_argv and not browser_set == "comet":
|
|
482
|
+
if not bin_loc_in_options:
|
|
483
|
+
bin_loc = detect_b_ver.get_binary_location("comet")
|
|
484
|
+
if os.path.exists(bin_loc):
|
|
485
|
+
browser_changes += 1
|
|
486
|
+
browser_text = "comet"
|
|
487
|
+
sb_config._browser_shortcut = "comet"
|
|
488
|
+
sb_config._cdp_browser = "comet"
|
|
489
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
490
|
+
browser_list.append("--comet")
|
|
491
|
+
if "--atlas" in sys_argv and not browser_set == "atlas":
|
|
492
|
+
if not bin_loc_in_options:
|
|
493
|
+
bin_loc = detect_b_ver.get_binary_location("atlas")
|
|
494
|
+
if os.path.exists(bin_loc):
|
|
495
|
+
browser_changes += 1
|
|
496
|
+
browser_text = "atlas"
|
|
497
|
+
sb_config._browser_shortcut = "atlas"
|
|
498
|
+
sb_config._cdp_browser = "atlas"
|
|
499
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
500
|
+
browser_list.append("--atlas")
|
|
393
501
|
if browser_changes > 1:
|
|
394
502
|
message = "\n\n TOO MANY browser types were entered!"
|
|
395
503
|
message += "\n There were %s found:\n > %s" % (
|
|
@@ -692,7 +800,10 @@ def SB(
|
|
|
692
800
|
uc_cdp_events = True
|
|
693
801
|
else:
|
|
694
802
|
uc_cdp_events = False
|
|
695
|
-
if
|
|
803
|
+
if (
|
|
804
|
+
undetectable
|
|
805
|
+
and browser not in ["chrome", "opera", "brave", "comet", "atlas"]
|
|
806
|
+
):
|
|
696
807
|
message = (
|
|
697
808
|
'\n Undetected-Chromedriver Mode ONLY supports Chrome!'
|
|
698
809
|
'\n ("uc=True" / "undetectable=True" / "--uc")'
|
|
@@ -1019,6 +1130,10 @@ def SB(
|
|
|
1019
1130
|
|
|
1020
1131
|
sb_config.with_testing_base = with_testing_base
|
|
1021
1132
|
sb_config.browser = browser
|
|
1133
|
+
if sb_config._browser_shortcut:
|
|
1134
|
+
sb_config.browser = sb_config._browser_shortcut
|
|
1135
|
+
if sb_config.browser in constants.ChromiumSubs.chromium_subs:
|
|
1136
|
+
sb_config.browser = "chrome" # Still uses chromedriver
|
|
1022
1137
|
if not hasattr(sb_config, "is_behave"):
|
|
1023
1138
|
sb_config.is_behave = False
|
|
1024
1139
|
if not hasattr(sb_config, "is_pytest"):
|
|
@@ -1082,6 +1197,8 @@ def SB(
|
|
|
1082
1197
|
sb_config.save_screenshot = save_screenshot
|
|
1083
1198
|
sb_config.no_screenshot = no_screenshot
|
|
1084
1199
|
sb_config.binary_location = binary_location
|
|
1200
|
+
if hasattr(sb_config, "_cdp_bin_loc") and sb_config._cdp_bin_loc:
|
|
1201
|
+
sb_config.binary_location = sb_config._cdp_bin_loc
|
|
1085
1202
|
sb_config.driver_version = driver_version
|
|
1086
1203
|
sb_config.page_load_strategy = page_load_strategy
|
|
1087
1204
|
sb_config.timeout_multiplier = timeout_multiplier
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"""Selenium Plugin for SeleniumBase tests that run with pynose / nosetests"""
|
|
2
|
+
import os
|
|
2
3
|
import sys
|
|
3
4
|
from contextlib import suppress
|
|
4
5
|
from nose.plugins import Plugin
|
|
5
6
|
from seleniumbase import config as sb_config
|
|
6
7
|
from seleniumbase.config import settings
|
|
8
|
+
from seleniumbase.core import detect_b_ver
|
|
7
9
|
from seleniumbase.core import proxy_helper
|
|
8
10
|
from seleniumbase.fixtures import constants
|
|
9
11
|
from seleniumbase.fixtures import shared_utils
|
|
@@ -16,6 +18,10 @@ class SeleniumBrowser(Plugin):
|
|
|
16
18
|
--edge (Shortcut for "--browser=edge".)
|
|
17
19
|
--firefox (Shortcut for "--browser=firefox".)
|
|
18
20
|
--safari (Shortcut for "--browser=safari".)
|
|
21
|
+
--opera (Shortcut for "--browser=opera".)
|
|
22
|
+
--brave (Shortcut for "--browser=brave".)
|
|
23
|
+
--comet (Shortcut for "--browser=comet".)
|
|
24
|
+
--atlas (Shortcut for "--browser=atlas".)
|
|
19
25
|
--cft (Shortcut for using `Chrome for Testing`)
|
|
20
26
|
--chs (Shortcut for using `Chrome-Headless-Shell`)
|
|
21
27
|
--user-data-dir=DIR (Set the Chrome user data directory to use.)
|
|
@@ -146,6 +152,34 @@ class SeleniumBrowser(Plugin):
|
|
|
146
152
|
default=False,
|
|
147
153
|
help="""Shortcut for --browser=safari""",
|
|
148
154
|
)
|
|
155
|
+
parser.addoption(
|
|
156
|
+
"--opera",
|
|
157
|
+
action="store_true",
|
|
158
|
+
dest="use_opera",
|
|
159
|
+
default=False,
|
|
160
|
+
help="""Shortcut for --browser=opera""",
|
|
161
|
+
)
|
|
162
|
+
parser.addoption(
|
|
163
|
+
"--brave",
|
|
164
|
+
action="store_true",
|
|
165
|
+
dest="use_brave",
|
|
166
|
+
default=False,
|
|
167
|
+
help="""Shortcut for --browser=brave""",
|
|
168
|
+
)
|
|
169
|
+
parser.addoption(
|
|
170
|
+
"--comet",
|
|
171
|
+
action="store_true",
|
|
172
|
+
dest="use_comet",
|
|
173
|
+
default=False,
|
|
174
|
+
help="""Shortcut for --browser=comet""",
|
|
175
|
+
)
|
|
176
|
+
parser.addoption(
|
|
177
|
+
"--atlas",
|
|
178
|
+
action="store_true",
|
|
179
|
+
dest="use_atlas",
|
|
180
|
+
default=False,
|
|
181
|
+
help="""Shortcut for --browser=atlas""",
|
|
182
|
+
)
|
|
149
183
|
parser.addoption(
|
|
150
184
|
"--cft",
|
|
151
185
|
action="store_true",
|
|
@@ -1057,6 +1091,11 @@ class SeleniumBrowser(Plugin):
|
|
|
1057
1091
|
browser_set = None
|
|
1058
1092
|
browser_text = None
|
|
1059
1093
|
browser_list = []
|
|
1094
|
+
# Check if binary-location in options
|
|
1095
|
+
bin_loc_in_options = False
|
|
1096
|
+
for arg in sys_argv:
|
|
1097
|
+
if arg in ["--binary-location", "--binary_location", "--bl"]:
|
|
1098
|
+
bin_loc_in_options = True
|
|
1060
1099
|
if "--browser=chrome" in sys_argv or "--browser chrome" in sys_argv:
|
|
1061
1100
|
browser_changes += 1
|
|
1062
1101
|
browser_set = "chrome"
|
|
@@ -1081,6 +1120,46 @@ class SeleniumBrowser(Plugin):
|
|
|
1081
1120
|
browser_changes += 1
|
|
1082
1121
|
browser_set = "remote"
|
|
1083
1122
|
browser_list.append("--browser=remote")
|
|
1123
|
+
if "--browser=opera" in sys_argv or "--browser opera" in sys_argv:
|
|
1124
|
+
if not bin_loc_in_options:
|
|
1125
|
+
bin_loc = detect_b_ver.get_binary_location("opera")
|
|
1126
|
+
if os.path.exists(bin_loc):
|
|
1127
|
+
browser_changes += 1
|
|
1128
|
+
browser_set = "opera"
|
|
1129
|
+
sb_config._browser_shortcut = "opera"
|
|
1130
|
+
sb_config._cdp_browser = "opera"
|
|
1131
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
1132
|
+
browser_list.append("--browser=opera")
|
|
1133
|
+
if "--browser=brave" in sys_argv or "--browser brave" in sys_argv:
|
|
1134
|
+
if not bin_loc_in_options:
|
|
1135
|
+
bin_loc = detect_b_ver.get_binary_location("brave")
|
|
1136
|
+
if os.path.exists(bin_loc):
|
|
1137
|
+
browser_changes += 1
|
|
1138
|
+
browser_set = "brave"
|
|
1139
|
+
sb_config._browser_shortcut = "brave"
|
|
1140
|
+
sb_config._cdp_browser = "brave"
|
|
1141
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
1142
|
+
browser_list.append("--browser=brave")
|
|
1143
|
+
if "--browser=comet" in sys_argv or "--browser comet" in sys_argv:
|
|
1144
|
+
if not bin_loc_in_options:
|
|
1145
|
+
bin_loc = detect_b_ver.get_binary_location("comet")
|
|
1146
|
+
if os.path.exists(bin_loc):
|
|
1147
|
+
browser_changes += 1
|
|
1148
|
+
browser_set = "comet"
|
|
1149
|
+
sb_config._browser_shortcut = "comet"
|
|
1150
|
+
sb_config._cdp_browser = "comet"
|
|
1151
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
1152
|
+
browser_list.append("--browser=comet")
|
|
1153
|
+
if "--browser=atlas" in sys_argv or "--browser atlas" in sys_argv:
|
|
1154
|
+
if not bin_loc_in_options:
|
|
1155
|
+
bin_loc = detect_b_ver.get_binary_location("atlas")
|
|
1156
|
+
if os.path.exists(bin_loc):
|
|
1157
|
+
browser_changes += 1
|
|
1158
|
+
browser_set = "atlas"
|
|
1159
|
+
sb_config._browser_shortcut = "atlas"
|
|
1160
|
+
sb_config._cdp_browser = "atlas"
|
|
1161
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
1162
|
+
browser_list.append("--browser=atlas")
|
|
1084
1163
|
browser_text = browser_set
|
|
1085
1164
|
if "--chrome" in sys_argv and not browser_set == "chrome":
|
|
1086
1165
|
browser_changes += 1
|
|
@@ -1107,6 +1186,46 @@ class SeleniumBrowser(Plugin):
|
|
|
1107
1186
|
browser_text = "safari"
|
|
1108
1187
|
sb_config._browser_shortcut = "safari"
|
|
1109
1188
|
browser_list.append("--safari")
|
|
1189
|
+
if "--opera" in sys_argv and not browser_set == "opera":
|
|
1190
|
+
if not bin_loc_in_options:
|
|
1191
|
+
bin_loc = detect_b_ver.get_binary_location("opera")
|
|
1192
|
+
if os.path.exists(bin_loc):
|
|
1193
|
+
browser_changes += 1
|
|
1194
|
+
browser_text = "opera"
|
|
1195
|
+
sb_config._browser_shortcut = "opera"
|
|
1196
|
+
sb_config._cdp_browser = "opera"
|
|
1197
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
1198
|
+
browser_list.append("--opera")
|
|
1199
|
+
if "--brave" in sys_argv and not browser_set == "brave":
|
|
1200
|
+
if not bin_loc_in_options:
|
|
1201
|
+
bin_loc = detect_b_ver.get_binary_location("brave")
|
|
1202
|
+
if os.path.exists(bin_loc):
|
|
1203
|
+
browser_changes += 1
|
|
1204
|
+
browser_text = "brave"
|
|
1205
|
+
sb_config._browser_shortcut = "brave"
|
|
1206
|
+
sb_config._cdp_browser = "brave"
|
|
1207
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
1208
|
+
browser_list.append("--brave")
|
|
1209
|
+
if "--comet" in sys_argv and not browser_set == "comet":
|
|
1210
|
+
if not bin_loc_in_options:
|
|
1211
|
+
bin_loc = detect_b_ver.get_binary_location("comet")
|
|
1212
|
+
if os.path.exists(bin_loc):
|
|
1213
|
+
browser_changes += 1
|
|
1214
|
+
browser_text = "comet"
|
|
1215
|
+
sb_config._browser_shortcut = "comet"
|
|
1216
|
+
sb_config._cdp_browser = "comet"
|
|
1217
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
1218
|
+
browser_list.append("--comet")
|
|
1219
|
+
if "--atlas" in sys_argv and not browser_set == "atlas":
|
|
1220
|
+
if not bin_loc_in_options:
|
|
1221
|
+
bin_loc = detect_b_ver.get_binary_location("atlas")
|
|
1222
|
+
if os.path.exists(bin_loc):
|
|
1223
|
+
browser_changes += 1
|
|
1224
|
+
browser_text = "atlas"
|
|
1225
|
+
sb_config._browser_shortcut = "atlas"
|
|
1226
|
+
sb_config._cdp_browser = "atlas"
|
|
1227
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
1228
|
+
browser_list.append("--atlas")
|
|
1110
1229
|
if browser_changes > 1:
|
|
1111
1230
|
message = "\n\n TOO MANY browser types were entered!"
|
|
1112
1231
|
message += "\n There were %s found:\n > %s" % (
|
|
@@ -1183,6 +1302,8 @@ class SeleniumBrowser(Plugin):
|
|
|
1183
1302
|
if sb_config._browser_shortcut:
|
|
1184
1303
|
self.options.browser = sb_config._browser_shortcut
|
|
1185
1304
|
test.test.browser = sb_config._browser_shortcut
|
|
1305
|
+
if test.test.browser in constants.ChromiumSubs.chromium_subs:
|
|
1306
|
+
test.test.browser = "chrome" # Still uses chromedriver
|
|
1186
1307
|
test.test.cap_file = self.options.cap_file
|
|
1187
1308
|
test.test.cap_string = self.options.cap_string
|
|
1188
1309
|
test.test.headless = self.options.headless
|
|
@@ -1219,6 +1340,8 @@ class SeleniumBrowser(Plugin):
|
|
|
1219
1340
|
test.test.extension_dir = self.options.extension_dir
|
|
1220
1341
|
test.test.disable_features = self.options.disable_features
|
|
1221
1342
|
test.test.binary_location = self.options.binary_location
|
|
1343
|
+
if hasattr(sb_config, "_cdp_bin_loc") and sb_config._cdp_bin_loc:
|
|
1344
|
+
test.test.binary_location = sb_config._cdp_bin_loc
|
|
1222
1345
|
if self.options.use_cft and not test.test.binary_location:
|
|
1223
1346
|
test.test.binary_location = "cft"
|
|
1224
1347
|
elif self.options.use_chs and not test.test.binary_location:
|
|
@@ -484,7 +484,7 @@ def main():
|
|
|
484
484
|
print("")
|
|
485
485
|
raise Exception(message)
|
|
486
486
|
|
|
487
|
-
with open(seleniumbase_file, "r", encoding="utf-8") as f:
|
|
487
|
+
with open(seleniumbase_file, mode="r", encoding="utf-8") as f:
|
|
488
488
|
all_code = f.read()
|
|
489
489
|
if "def test_" not in all_code and "from seleniumbase" not in all_code:
|
|
490
490
|
print("")
|
|
@@ -1042,7 +1042,7 @@ def main():
|
|
|
1042
1042
|
pass # Print-only run already done
|
|
1043
1043
|
|
|
1044
1044
|
if new_file_name:
|
|
1045
|
-
out_file = open(new_file_name, "w+", encoding="utf-8")
|
|
1045
|
+
out_file = open(new_file_name, mode="w+", encoding="utf-8")
|
|
1046
1046
|
out_file.writelines("\r\n".join(seleniumbase_lines))
|
|
1047
1047
|
out_file.close()
|
|
1048
1048
|
results_saved = (
|
|
@@ -554,11 +554,59 @@ 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
|
|
596
|
+
else:
|
|
597
|
+
bin_loc = str(browser_executable_path).lower()
|
|
598
|
+
if bin_loc.endswith("opera") or bin_loc.endswith("opera.exe"):
|
|
599
|
+
sb_config._cdp_browser = "opera"
|
|
600
|
+
elif bin_loc.endswith("edge") or bin_loc.endswith("edge.exe"):
|
|
601
|
+
sb_config._cdp_browser = "edge"
|
|
602
|
+
elif bin_loc.endswith("brave") or bin_loc.endswith("brave.exe"):
|
|
603
|
+
sb_config._cdp_browser = "brave"
|
|
604
|
+
elif bin_loc.endswith("comet") or bin_loc.endswith("comet.exe"):
|
|
605
|
+
sb_config._cdp_browser = "comet"
|
|
606
|
+
elif bin_loc.endswith("atlas") or bin_loc.endswith("atlas.exe"):
|
|
607
|
+
sb_config._cdp_browser = "atlas"
|
|
608
|
+
else:
|
|
609
|
+
sb_config._cdp_browser = "chrome"
|
|
562
610
|
if not config:
|
|
563
611
|
config = Config(
|
|
564
612
|
user_data_dir,
|
|
@@ -622,23 +670,8 @@ async def start(
|
|
|
622
670
|
|
|
623
671
|
|
|
624
672
|
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
|
-
):
|
|
673
|
+
if "user_data_dir" in kwargs and kwargs["user_data_dir"]:
|
|
674
|
+
headless = False
|
|
642
675
|
if "headless" in kwargs:
|
|
643
676
|
headless = kwargs["headless"]
|
|
644
677
|
decoy_args = kwargs
|
|
@@ -662,23 +695,8 @@ def start_sync(*args, **kwargs) -> Browser:
|
|
|
662
695
|
loop = kwargs["loop"]
|
|
663
696
|
else:
|
|
664
697
|
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
|
-
):
|
|
698
|
+
if "user_data_dir" in kwargs and kwargs["user_data_dir"]:
|
|
699
|
+
headless = False
|
|
682
700
|
if "headless" in kwargs:
|
|
683
701
|
headless = kwargs["headless"]
|
|
684
702
|
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
|
|
|
@@ -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())
|
|
@@ -77,7 +77,7 @@ def main():
|
|
|
77
77
|
data = []
|
|
78
78
|
data.append(verbose)
|
|
79
79
|
file_path = os.path.join(dir_path, "verbose_hub_server.dat")
|
|
80
|
-
file = open(file_path, "w+", "utf-8")
|
|
80
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
81
81
|
file.writelines("\r\n".join(data))
|
|
82
82
|
file.close()
|
|
83
83
|
|
|
@@ -87,14 +87,14 @@ def main():
|
|
|
87
87
|
data = []
|
|
88
88
|
data.append(server_ip)
|
|
89
89
|
file_path = os.path.join(dir_path, "ip_of_grid_hub.dat")
|
|
90
|
-
file = open(file_path, "w+", "utf-8")
|
|
90
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
91
91
|
file.writelines("\r\n".join(data))
|
|
92
92
|
file.close()
|
|
93
93
|
|
|
94
94
|
data = []
|
|
95
95
|
data.append(verbose)
|
|
96
96
|
file_path = os.path.join(dir_path, "verbose_node_server.dat")
|
|
97
|
-
file = open(file_path, "w+", "utf-8")
|
|
97
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
98
98
|
file.writelines("\r\n".join(data))
|
|
99
99
|
file.close()
|
|
100
100
|
|
|
@@ -59,7 +59,7 @@ def main():
|
|
|
59
59
|
uses_keys = False
|
|
60
60
|
uses_select = False
|
|
61
61
|
|
|
62
|
-
with open(webdriver_python_file, "r", encoding="utf-8") as f:
|
|
62
|
+
with open(webdriver_python_file, mode="r", encoding="utf-8") as f:
|
|
63
63
|
all_code = f.read()
|
|
64
64
|
if "def test_" not in all_code:
|
|
65
65
|
raise Exception(
|
|
@@ -893,7 +893,7 @@ def main():
|
|
|
893
893
|
# Create SeleniumBase test file
|
|
894
894
|
base_file_name = webdriver_python_file.split(".py")[0]
|
|
895
895
|
converted_file_name = base_file_name + "_SB.py"
|
|
896
|
-
out_file = open(converted_file_name, "w+", encoding="utf-8")
|
|
896
|
+
out_file = open(converted_file_name, mode="w+", encoding="utf-8")
|
|
897
897
|
out_file.writelines(seleniumbase_code)
|
|
898
898
|
out_file.close()
|
|
899
899
|
print(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: seleniumbase
|
|
3
|
-
Version: 4.43.
|
|
3
|
+
Version: 4.43.3
|
|
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
|
|
@@ -871,6 +871,10 @@ pytest test_coffee_cart.py --trace
|
|
|
871
871
|
--edge # (Shortcut for "--browser=edge".)
|
|
872
872
|
--firefox # (Shortcut for "--browser=firefox".)
|
|
873
873
|
--safari # (Shortcut for "--browser=safari".)
|
|
874
|
+
--opera # (Shortcut for "--browser=opera".)
|
|
875
|
+
--brave # (Shortcut for "--browser=brave".)
|
|
876
|
+
--comet # (Shortcut for "--browser=comet".)
|
|
877
|
+
--atlas # (Shortcut for "--browser=atlas".)
|
|
874
878
|
--settings-file=FILE # (Override default SeleniumBase settings.)
|
|
875
879
|
--env=ENV # (Set the test env. Access with "self.env" in tests.)
|
|
876
880
|
--account=STR # (Set account. Access with "self.account" in tests.)
|