seleniumbase 4.41.3__py3-none-any.whl → 4.45.10__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.
- sbase/steps.py +9 -0
- seleniumbase/__version__.py +1 -1
- seleniumbase/behave/behave_helper.py +2 -0
- seleniumbase/behave/behave_sb.py +21 -8
- seleniumbase/common/decorators.py +3 -1
- seleniumbase/console_scripts/run.py +1 -0
- seleniumbase/console_scripts/sb_caseplans.py +3 -4
- seleniumbase/console_scripts/sb_install.py +142 -11
- seleniumbase/console_scripts/sb_mkchart.py +1 -2
- seleniumbase/console_scripts/sb_mkdir.py +99 -29
- seleniumbase/console_scripts/sb_mkfile.py +1 -2
- seleniumbase/console_scripts/sb_mkpres.py +1 -2
- seleniumbase/console_scripts/sb_mkrec.py +26 -2
- seleniumbase/console_scripts/sb_objectify.py +4 -5
- seleniumbase/console_scripts/sb_print.py +1 -1
- seleniumbase/console_scripts/sb_recorder.py +40 -3
- seleniumbase/core/browser_launcher.py +474 -151
- seleniumbase/core/detect_b_ver.py +258 -16
- seleniumbase/core/log_helper.py +15 -21
- seleniumbase/core/mysql.py +1 -1
- seleniumbase/core/recorder_helper.py +3 -0
- seleniumbase/core/report_helper.py +9 -12
- seleniumbase/core/sb_cdp.py +734 -215
- seleniumbase/core/sb_driver.py +46 -5
- seleniumbase/core/session_helper.py +2 -4
- seleniumbase/core/tour_helper.py +1 -2
- seleniumbase/drivers/atlas_drivers/__init__.py +0 -0
- seleniumbase/drivers/brave_drivers/__init__.py +0 -0
- seleniumbase/drivers/chromium_drivers/__init__.py +0 -0
- seleniumbase/drivers/comet_drivers/__init__.py +0 -0
- seleniumbase/drivers/opera_drivers/__init__.py +0 -0
- seleniumbase/fixtures/base_case.py +448 -251
- seleniumbase/fixtures/constants.py +36 -9
- seleniumbase/fixtures/js_utils.py +77 -18
- seleniumbase/fixtures/page_actions.py +41 -13
- seleniumbase/fixtures/page_utils.py +19 -12
- seleniumbase/fixtures/shared_utils.py +64 -6
- seleniumbase/masterqa/master_qa.py +16 -2
- seleniumbase/plugins/base_plugin.py +8 -0
- seleniumbase/plugins/basic_test_info.py +2 -3
- seleniumbase/plugins/driver_manager.py +131 -5
- seleniumbase/plugins/page_source.py +2 -3
- seleniumbase/plugins/pytest_plugin.py +244 -79
- seleniumbase/plugins/sb_manager.py +143 -20
- seleniumbase/plugins/selenium_plugin.py +144 -12
- seleniumbase/translate/translator.py +2 -3
- seleniumbase/undetected/__init__.py +17 -13
- seleniumbase/undetected/cdp.py +1 -12
- seleniumbase/undetected/cdp_driver/browser.py +330 -129
- seleniumbase/undetected/cdp_driver/cdp_util.py +328 -61
- seleniumbase/undetected/cdp_driver/config.py +110 -14
- seleniumbase/undetected/cdp_driver/connection.py +18 -48
- seleniumbase/undetected/cdp_driver/element.py +105 -33
- seleniumbase/undetected/cdp_driver/tab.py +414 -39
- 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.41.3.dist-info → seleniumbase-4.45.10.dist-info}/METADATA +193 -166
- {seleniumbase-4.41.3.dist-info → seleniumbase-4.45.10.dist-info}/RECORD +64 -59
- {seleniumbase-4.41.3.dist-info → seleniumbase-4.45.10.dist-info}/licenses/LICENSE +1 -1
- {seleniumbase-4.41.3.dist-info → seleniumbase-4.45.10.dist-info}/WHEEL +0 -0
- {seleniumbase-4.41.3.dist-info → seleniumbase-4.45.10.dist-info}/entry_points.txt +0 -0
- {seleniumbase-4.41.3.dist-info → seleniumbase-4.45.10.dist-info}/top_level.txt +0 -0
sbase/steps.py
CHANGED
|
@@ -1191,6 +1191,15 @@ def set_attributes(context, selector, attribute, value):
|
|
|
1191
1191
|
sb.set_attributes(selector, attribute, value)
|
|
1192
1192
|
|
|
1193
1193
|
|
|
1194
|
+
@step("Save as PDF to logs")
|
|
1195
|
+
@step("Save as PDF to the logs")
|
|
1196
|
+
@step("User saves page as PDF to logs")
|
|
1197
|
+
@step("User saves page as PDF to the logs")
|
|
1198
|
+
def save_as_pdf_to_logs(context):
|
|
1199
|
+
sb = context.sb
|
|
1200
|
+
sb.save_as_pdf_to_logs()
|
|
1201
|
+
|
|
1202
|
+
|
|
1194
1203
|
@step("Save page source to logs")
|
|
1195
1204
|
@step("Save the page source to the logs")
|
|
1196
1205
|
@step("User saves page source to logs")
|
seleniumbase/__version__.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# seleniumbase package
|
|
2
|
-
__version__ = "4.
|
|
2
|
+
__version__ = "4.45.10"
|
|
@@ -522,6 +522,8 @@ def generate_gherkin(srt_actions):
|
|
|
522
522
|
)
|
|
523
523
|
elif action[0] == "ss_tl":
|
|
524
524
|
sb_actions.append("Save screenshot to logs")
|
|
525
|
+
elif action[0] == "pdftl":
|
|
526
|
+
sb_actions.append("Save as PDF to logs")
|
|
525
527
|
elif action[0] == "spstl":
|
|
526
528
|
sb_actions.append("Save page source to logs")
|
|
527
529
|
elif action[0] == "sh_fc":
|
seleniumbase/behave/behave_sb.py
CHANGED
|
@@ -113,6 +113,7 @@ import sys
|
|
|
113
113
|
from contextlib import suppress
|
|
114
114
|
from seleniumbase import config as sb_config
|
|
115
115
|
from seleniumbase.config import settings
|
|
116
|
+
from seleniumbase.core import detect_b_ver
|
|
116
117
|
from seleniumbase.core import download_helper
|
|
117
118
|
from seleniumbase.core import log_helper
|
|
118
119
|
from seleniumbase.core import proxy_helper
|
|
@@ -493,6 +494,12 @@ def get_configured_sb(context):
|
|
|
493
494
|
sb.binary_location = binary_location
|
|
494
495
|
sb_config.binary_location = binary_location
|
|
495
496
|
continue
|
|
497
|
+
# Handle: -D use-chromium
|
|
498
|
+
if low_key in ["use-chromium"] and not sb_config.binary_location:
|
|
499
|
+
binary_location = "_chromium_"
|
|
500
|
+
sb.binary_location = binary_location
|
|
501
|
+
sb_config.binary_location = binary_location
|
|
502
|
+
continue
|
|
496
503
|
# Handle: -D cft
|
|
497
504
|
if low_key in ["cft"] and not sb_config.binary_location:
|
|
498
505
|
binary_location = "cft"
|
|
@@ -890,6 +897,13 @@ def get_configured_sb(context):
|
|
|
890
897
|
"\nOnly ONE default browser is allowed!\n"
|
|
891
898
|
"%s browsers were selected: %s" % (len(browsers), browsers)
|
|
892
899
|
)
|
|
900
|
+
if sb.browser in ["opera", "brave", "comet", "atlas"]:
|
|
901
|
+
bin_loc = detect_b_ver.get_binary_location(sb.browser)
|
|
902
|
+
if bin_loc and os.path.exists(bin_loc):
|
|
903
|
+
sb_config._cdp_browser = sb.browser
|
|
904
|
+
sb_config._cdp_bin_loc = bin_loc
|
|
905
|
+
sb_config.binary_location = bin_loc
|
|
906
|
+
sb.binary_location = bin_loc
|
|
893
907
|
# Recorder Mode can still optimize scripts in "-D headless2" mode.
|
|
894
908
|
if sb.recorder_ext and sb.headless:
|
|
895
909
|
sb.headless = False
|
|
@@ -1205,7 +1219,6 @@ def dashboard_pre_processing():
|
|
|
1205
1219
|
|
|
1206
1220
|
|
|
1207
1221
|
def _create_dashboard_assets_():
|
|
1208
|
-
import codecs
|
|
1209
1222
|
from seleniumbase.js_code.live_js import live_js
|
|
1210
1223
|
from seleniumbase.core.style_sheet import get_pytest_style
|
|
1211
1224
|
|
|
@@ -1217,24 +1230,24 @@ def _create_dashboard_assets_():
|
|
|
1217
1230
|
add_pytest_style_css = True
|
|
1218
1231
|
if os.path.exists(pytest_style_css):
|
|
1219
1232
|
existing_pytest_style = None
|
|
1220
|
-
with open(pytest_style_css, "r") as f:
|
|
1233
|
+
with open(pytest_style_css, mode="r") as f:
|
|
1221
1234
|
existing_pytest_style = f.read()
|
|
1222
1235
|
if existing_pytest_style == get_pytest_style():
|
|
1223
1236
|
add_pytest_style_css = False
|
|
1224
1237
|
if add_pytest_style_css:
|
|
1225
|
-
out_file =
|
|
1238
|
+
out_file = open(pytest_style_css, mode="w+", encoding="utf-8")
|
|
1226
1239
|
out_file.writelines(get_pytest_style())
|
|
1227
1240
|
out_file.close()
|
|
1228
1241
|
live_js_file = os.path.join(assets_folder, "live.js")
|
|
1229
1242
|
add_live_js_file = True
|
|
1230
1243
|
if os.path.exists(live_js_file):
|
|
1231
1244
|
existing_live_js = None
|
|
1232
|
-
with open(live_js_file, "r") as f:
|
|
1245
|
+
with open(live_js_file, mode="r") as f:
|
|
1233
1246
|
existing_live_js = f.read()
|
|
1234
1247
|
if existing_live_js == live_js:
|
|
1235
1248
|
add_live_js_file = False
|
|
1236
1249
|
if add_live_js_file:
|
|
1237
|
-
out_file =
|
|
1250
|
+
out_file = open(live_js_file, mode="w+", encoding="utf-8")
|
|
1238
1251
|
out_file.writelines(live_js)
|
|
1239
1252
|
out_file.close()
|
|
1240
1253
|
|
|
@@ -1307,7 +1320,7 @@ def _perform_behave_unconfigure_():
|
|
|
1307
1320
|
# Part 1: Finalizing the dashboard / integrating html report
|
|
1308
1321
|
if os.path.exists(dashboard_path):
|
|
1309
1322
|
the_html_d = None
|
|
1310
|
-
with open(dashboard_path, "r", encoding="utf-8") as f:
|
|
1323
|
+
with open(dashboard_path, mode="r", encoding="utf-8") as f:
|
|
1311
1324
|
the_html_d = f.read()
|
|
1312
1325
|
if sb_config._multithreaded and "-c" in sys.argv:
|
|
1313
1326
|
# Threads have "-c" in sys.argv, except for the last
|
|
@@ -1318,7 +1331,7 @@ def _perform_behave_unconfigure_():
|
|
|
1318
1331
|
if os.path.exists(pie_path):
|
|
1319
1332
|
import json
|
|
1320
1333
|
|
|
1321
|
-
with open(pie_path, "r") as f:
|
|
1334
|
+
with open(pie_path, mode="r") as f:
|
|
1322
1335
|
dash_pie = f.read().strip()
|
|
1323
1336
|
sb_config._saved_dashboard_pie = json.loads(dash_pie)
|
|
1324
1337
|
# If the test run doesn't complete by itself, stop refresh
|
|
@@ -1327,7 +1340,7 @@ def _perform_behave_unconfigure_():
|
|
|
1327
1340
|
the_html_d = the_html_d.replace(find_it_3, swap_with_3)
|
|
1328
1341
|
the_html_d = the_html_d.replace(find_it_4, swap_with_4)
|
|
1329
1342
|
the_html_d += stamp
|
|
1330
|
-
with open(dashboard_path, "w", encoding="utf-8") as f:
|
|
1343
|
+
with open(dashboard_path, mode="w", encoding="utf-8") as f:
|
|
1331
1344
|
f.write(the_html_d) # Finalize the dashboard
|
|
1332
1345
|
except KeyboardInterrupt:
|
|
1333
1346
|
pass
|
|
@@ -53,7 +53,9 @@ def print_runtime(description=None, limit=None):
|
|
|
53
53
|
name = description
|
|
54
54
|
info = c1 + "<info>" + cr
|
|
55
55
|
# Print times with a statistically significant number of decimal places
|
|
56
|
-
if run_time < 0.
|
|
56
|
+
if run_time < 0.00001:
|
|
57
|
+
print("%s - {%s} ran for %.8f seconds." % (info, name, run_time))
|
|
58
|
+
elif run_time < 0.0001:
|
|
57
59
|
print("%s - {%s} ran for %.7f seconds." % (info, name, run_time))
|
|
58
60
|
elif run_time < 0.001:
|
|
59
61
|
print("%s - {%s} ran for %.6f seconds." % (info, name, run_time))
|
|
@@ -248,6 +248,7 @@ def show_mkdir_usage():
|
|
|
248
248
|
print(" sbase mkdir ui_tests")
|
|
249
249
|
print(" Options:")
|
|
250
250
|
print(" -b / --basic (Only config files. No tests added.)")
|
|
251
|
+
print(" --gha (Include GitHub Actions YML with defaults.)")
|
|
251
252
|
print(" Output:")
|
|
252
253
|
print(" Creates a new folder for running SBase scripts.")
|
|
253
254
|
print(" The new folder contains default config files,")
|
|
@@ -15,7 +15,6 @@ Examples:
|
|
|
15
15
|
Output:
|
|
16
16
|
Launches the SeleniumBase Case Plans Generator.
|
|
17
17
|
"""
|
|
18
|
-
import codecs
|
|
19
18
|
import colorama
|
|
20
19
|
import os
|
|
21
20
|
import subprocess
|
|
@@ -135,7 +134,7 @@ def generate_case_plan_boilerplates(
|
|
|
135
134
|
file_name = case_id
|
|
136
135
|
file_path = os.path.join(full_folder_path, file_name)
|
|
137
136
|
if not os.path.exists(file_path):
|
|
138
|
-
out_file =
|
|
137
|
+
out_file = open(file_path, mode="w+", encoding="utf-8")
|
|
139
138
|
out_file.writelines("\r\n".join(data))
|
|
140
139
|
out_file.close()
|
|
141
140
|
new_plans += 1
|
|
@@ -183,7 +182,7 @@ def view_summary_of_existing_case_plans(root, tests):
|
|
|
183
182
|
else:
|
|
184
183
|
case_path = os.path.join(folder_path, "case_plans", case_id)
|
|
185
184
|
if os.path.exists(case_path):
|
|
186
|
-
f = open(case_path, "r")
|
|
185
|
+
f = open(case_path, mode="r")
|
|
187
186
|
case_data = f.read()
|
|
188
187
|
f.close()
|
|
189
188
|
case_data_storage.append(case_data)
|
|
@@ -316,7 +315,7 @@ def view_summary_of_existing_case_plans(root, tests):
|
|
|
316
315
|
full_plan = plan_head
|
|
317
316
|
|
|
318
317
|
file_path = "case_summary.md"
|
|
319
|
-
file =
|
|
318
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
320
319
|
file.writelines("\r\n".join(full_plan))
|
|
321
320
|
file.close()
|
|
322
321
|
|
|
@@ -19,6 +19,7 @@ Examples:
|
|
|
19
19
|
sbase get chromedriver stable
|
|
20
20
|
sbase get chromedriver beta
|
|
21
21
|
sbase get chromedriver -p
|
|
22
|
+
sbase get chromium
|
|
22
23
|
sbase get cft 131
|
|
23
24
|
sbase get chs
|
|
24
25
|
Output:
|
|
@@ -46,16 +47,21 @@ from seleniumbase import config as sb_config
|
|
|
46
47
|
from seleniumbase import drivers # webdriver storage folder for SeleniumBase
|
|
47
48
|
from seleniumbase.drivers import cft_drivers # chrome-for-testing
|
|
48
49
|
from seleniumbase.drivers import chs_drivers # chrome-headless-shell
|
|
50
|
+
from seleniumbase.drivers import chromium_drivers # base chromium
|
|
49
51
|
|
|
50
52
|
urllib3.disable_warnings()
|
|
51
53
|
ARCH = platform.architecture()[0]
|
|
52
54
|
IS_ARM_MAC = shared_utils.is_arm_mac()
|
|
53
55
|
IS_MAC = shared_utils.is_mac()
|
|
56
|
+
IS_ARM_LINUX = shared_utils.is_arm_linux()
|
|
54
57
|
IS_LINUX = shared_utils.is_linux()
|
|
55
58
|
IS_WINDOWS = shared_utils.is_windows()
|
|
56
59
|
DRIVER_DIR = os.path.dirname(os.path.realpath(drivers.__file__))
|
|
57
60
|
DRIVER_DIR_CFT = os.path.dirname(os.path.realpath(cft_drivers.__file__))
|
|
58
61
|
DRIVER_DIR_CHS = os.path.dirname(os.path.realpath(chs_drivers.__file__))
|
|
62
|
+
DRIVER_DIR_CHROMIUM = os.path.dirname(
|
|
63
|
+
os.path.realpath(chromium_drivers.__file__)
|
|
64
|
+
)
|
|
59
65
|
LOCAL_PATH = "/usr/local/bin/" # On Mac and Linux systems
|
|
60
66
|
DEFAULT_CHROMEDRIVER_VERSION = "114.0.5735.90" # (If can't find LATEST_STABLE)
|
|
61
67
|
DEFAULT_GECKODRIVER_VERSION = "v0.36.0"
|
|
@@ -177,7 +183,7 @@ def requests_get_with_retry(url):
|
|
|
177
183
|
|
|
178
184
|
|
|
179
185
|
def get_cft_known_good_versions():
|
|
180
|
-
if
|
|
186
|
+
if getattr(sb_config, "cft_kgv_json", None):
|
|
181
187
|
return sb_config.cft_kgv_json
|
|
182
188
|
cft_ngv_url = (
|
|
183
189
|
"https://googlechromelabs.github.io/"
|
|
@@ -188,7 +194,7 @@ def get_cft_known_good_versions():
|
|
|
188
194
|
|
|
189
195
|
|
|
190
196
|
def get_cft_latest_versions_per_milestone():
|
|
191
|
-
if
|
|
197
|
+
if getattr(sb_config, "cft_lvpm_json", None):
|
|
192
198
|
return sb_config.cft_lvpm_json
|
|
193
199
|
cft_lvpm_url = (
|
|
194
200
|
"https://googlechromelabs.github.io/"
|
|
@@ -203,9 +209,62 @@ def get_cft_latest_version_from_milestone(milestone):
|
|
|
203
209
|
return url_request.json()["milestones"][milestone]["version"]
|
|
204
210
|
|
|
205
211
|
|
|
212
|
+
def get_chromium_channel_revision(platform_code, channel):
|
|
213
|
+
"""Snapshots only exist for revisions where a build occurred.
|
|
214
|
+
Therefore, not all found revisions will lead to snapshots."""
|
|
215
|
+
platform_key = None
|
|
216
|
+
if platform_code in ["Mac_Arm", "Mac"]:
|
|
217
|
+
platform_key = "Mac"
|
|
218
|
+
elif platform_code in ["Linux_x64"]:
|
|
219
|
+
platform_key = "Linux"
|
|
220
|
+
elif platform_code in ["Win_x64"]:
|
|
221
|
+
platform_key = "Windows"
|
|
222
|
+
elif platform_code in ["Win"]:
|
|
223
|
+
platform_key = "Win32"
|
|
224
|
+
channel_key = None
|
|
225
|
+
if channel.lower() == "stable":
|
|
226
|
+
channel_key = "Stable"
|
|
227
|
+
elif channel.lower() == "beta":
|
|
228
|
+
channel_key = "Beta"
|
|
229
|
+
elif channel.lower() == "dev":
|
|
230
|
+
channel_key = "Dev"
|
|
231
|
+
elif channel.lower() == "canary":
|
|
232
|
+
channel_key = "Canary"
|
|
233
|
+
base_url = "https://chromiumdash.appspot.com/fetch_releases"
|
|
234
|
+
url = f"{base_url}?channel={channel_key}&platform={platform_key}&num=1"
|
|
235
|
+
url_request = requests_get_with_retry(url)
|
|
236
|
+
data = None
|
|
237
|
+
if url_request.ok:
|
|
238
|
+
data = url_request.text
|
|
239
|
+
else:
|
|
240
|
+
raise Exception("Could not determine Chromium revision!")
|
|
241
|
+
if data:
|
|
242
|
+
try:
|
|
243
|
+
import ast
|
|
244
|
+
|
|
245
|
+
result = ast.literal_eval(data)
|
|
246
|
+
revision = result[0]["chromium_main_branch_position"]
|
|
247
|
+
return str(revision)
|
|
248
|
+
except Exception:
|
|
249
|
+
return get_latest_chromedriver_version(platform_code)
|
|
250
|
+
else:
|
|
251
|
+
return get_latest_chromedriver_version(platform_code)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def get_chromium_latest_revision(platform_code):
|
|
255
|
+
base_url = "https://storage.googleapis.com/chromium-browser-snapshots"
|
|
256
|
+
url = f"{base_url}/{platform_code}/LAST_CHANGE"
|
|
257
|
+
url_request = requests_get_with_retry(url)
|
|
258
|
+
if url_request.ok:
|
|
259
|
+
latest_revision = url_request.text
|
|
260
|
+
else:
|
|
261
|
+
raise Exception("Could not determine latest Chromium revision!")
|
|
262
|
+
return latest_revision
|
|
263
|
+
|
|
264
|
+
|
|
206
265
|
def get_latest_chromedriver_version(channel="Stable"):
|
|
207
266
|
try:
|
|
208
|
-
if
|
|
267
|
+
if getattr(sb_config, "cft_lkgv_json", None):
|
|
209
268
|
return sb_config.cft_lkgv_json["channels"][channel]["version"]
|
|
210
269
|
req = requests_get(
|
|
211
270
|
"https://googlechromelabs.github.io/"
|
|
@@ -239,10 +298,7 @@ def get_latest_canary_chromedriver_version():
|
|
|
239
298
|
def log_d(message):
|
|
240
299
|
"""If setting sb_config.settings.HIDE_DRIVER_DOWNLOADS to True,
|
|
241
300
|
output from driver downloads are logged instead of printed."""
|
|
242
|
-
if (
|
|
243
|
-
hasattr(sb_config.settings, "HIDE_DRIVER_DOWNLOADS")
|
|
244
|
-
and sb_config.settings.HIDE_DRIVER_DOWNLOADS
|
|
245
|
-
):
|
|
301
|
+
if getattr(sb_config.settings, "HIDE_DRIVER_DOWNLOADS", None):
|
|
246
302
|
logging.debug(message)
|
|
247
303
|
else:
|
|
248
304
|
print(message)
|
|
@@ -251,7 +307,7 @@ def log_d(message):
|
|
|
251
307
|
def main(override=None, intel_for_uc=None, force_uc=None):
|
|
252
308
|
if override:
|
|
253
309
|
found_proxy = None
|
|
254
|
-
if
|
|
310
|
+
if getattr(sb_config, "proxy_driver", None):
|
|
255
311
|
if " --proxy=" in " ".join(sys.argv):
|
|
256
312
|
for arg in sys.argv:
|
|
257
313
|
if arg.startswith("--proxy="):
|
|
@@ -277,6 +333,11 @@ def main(override=None, intel_for_uc=None, force_uc=None):
|
|
|
277
333
|
elif override.startswith("iedriver "):
|
|
278
334
|
extra = override.split("iedriver ")[1]
|
|
279
335
|
sys.argv = ["seleniumbase", "get", "iedriver", extra]
|
|
336
|
+
elif override == "chromium":
|
|
337
|
+
sys.argv = ["seleniumbase", "get", "chromium"]
|
|
338
|
+
elif override.startswith("chromium "):
|
|
339
|
+
extra = override.split("chromium ")[1]
|
|
340
|
+
sys.argv = ["seleniumbase", "get", "chromium", extra]
|
|
280
341
|
elif override == "cft":
|
|
281
342
|
sys.argv = ["seleniumbase", "get", "cft"]
|
|
282
343
|
elif override.startswith("cft "):
|
|
@@ -311,8 +372,7 @@ def main(override=None, intel_for_uc=None, force_uc=None):
|
|
|
311
372
|
downloads_folder = DRIVER_DIR
|
|
312
373
|
if (
|
|
313
374
|
hasattr(sb_config, "settings")
|
|
314
|
-
and
|
|
315
|
-
and sb_config.settings.NEW_DRIVER_DIR
|
|
375
|
+
and getattr(sb_config.settings, "NEW_DRIVER_DIR", None)
|
|
316
376
|
and os.path.exists(sb_config.settings.NEW_DRIVER_DIR)
|
|
317
377
|
):
|
|
318
378
|
downloads_folder = sb_config.settings.NEW_DRIVER_DIR
|
|
@@ -320,6 +380,8 @@ def main(override=None, intel_for_uc=None, force_uc=None):
|
|
|
320
380
|
downloads_folder = DRIVER_DIR_CFT
|
|
321
381
|
elif override == "chs" or name == "chs":
|
|
322
382
|
downloads_folder = DRIVER_DIR_CHS
|
|
383
|
+
elif override == "chromium":
|
|
384
|
+
downloads_folder = DRIVER_DIR_CHROMIUM
|
|
323
385
|
expected_contents = None
|
|
324
386
|
platform_code = None
|
|
325
387
|
copy_to_path = False
|
|
@@ -647,6 +709,31 @@ def main(override=None, intel_for_uc=None, force_uc=None):
|
|
|
647
709
|
"https://storage.googleapis.com/chrome-for-testing-public/"
|
|
648
710
|
"%s/%s/%s" % (use_version, platform_code, file_name)
|
|
649
711
|
)
|
|
712
|
+
elif name == "chromium":
|
|
713
|
+
if IS_MAC:
|
|
714
|
+
if IS_ARM_MAC:
|
|
715
|
+
platform_code = "Mac_Arm"
|
|
716
|
+
else:
|
|
717
|
+
platform_code = "Mac"
|
|
718
|
+
file_name = "chrome-mac.zip"
|
|
719
|
+
elif IS_LINUX:
|
|
720
|
+
platform_code = "Linux_x64"
|
|
721
|
+
file_name = "chrome-linux.zip"
|
|
722
|
+
elif IS_WINDOWS:
|
|
723
|
+
if "64" in ARCH:
|
|
724
|
+
platform_code = "Win_x64"
|
|
725
|
+
else:
|
|
726
|
+
platform_code = "Win"
|
|
727
|
+
file_name = "chrome-win.zip"
|
|
728
|
+
revision = get_chromium_latest_revision(platform_code)
|
|
729
|
+
msg = c2 + "Chromium revision to download" + cr
|
|
730
|
+
p_version = c3 + revision + cr
|
|
731
|
+
log_d("\n*** %s = %s" % (msg, p_version))
|
|
732
|
+
download_url = (
|
|
733
|
+
"https://storage.googleapis.com/chromium-browser-snapshots/"
|
|
734
|
+
"%s/%s/%s" % (platform_code, revision, file_name)
|
|
735
|
+
)
|
|
736
|
+
downloads_folder = DRIVER_DIR_CHROMIUM
|
|
650
737
|
elif name == "chrome-headless-shell" or name == "chs":
|
|
651
738
|
set_version = None
|
|
652
739
|
found_version = None
|
|
@@ -1007,12 +1094,12 @@ def main(override=None, intel_for_uc=None, force_uc=None):
|
|
|
1007
1094
|
remote_file = requests_get_with_retry(download_url)
|
|
1008
1095
|
with open(file_path, "wb") as file:
|
|
1009
1096
|
file.write(remote_file.content)
|
|
1010
|
-
log_d("%sDownload Complete!%s\n" % (c1, cr))
|
|
1011
1097
|
|
|
1012
1098
|
if file_name.endswith(".zip"):
|
|
1013
1099
|
zip_file_path = file_path
|
|
1014
1100
|
zip_ref = zipfile.ZipFile(zip_file_path, "r")
|
|
1015
1101
|
contents = zip_ref.namelist()
|
|
1102
|
+
log_d("%sDownload Complete!%s\n" % (c1, cr))
|
|
1016
1103
|
if (
|
|
1017
1104
|
len(contents) >= 1
|
|
1018
1105
|
and name in ["chromedriver", "uc_driver", "geckodriver"]
|
|
@@ -1253,6 +1340,48 @@ def main(override=None, intel_for_uc=None, force_uc=None):
|
|
|
1253
1340
|
"Chrome for Testing was saved inside:\n%s%s\n%s\n"
|
|
1254
1341
|
% (pr_base_path, pr_sep, pr_folder_name)
|
|
1255
1342
|
)
|
|
1343
|
+
elif name == "chromium":
|
|
1344
|
+
# Zip file is valid. Proceed.
|
|
1345
|
+
driver_path = None
|
|
1346
|
+
driver_file = None
|
|
1347
|
+
base_path = os.sep.join(zip_file_path.split(os.sep)[:-1])
|
|
1348
|
+
folder_name = contents[0].split("/")[0]
|
|
1349
|
+
folder_path = os.path.join(base_path, folder_name)
|
|
1350
|
+
if IS_MAC or IS_LINUX:
|
|
1351
|
+
if (
|
|
1352
|
+
"chromium" in folder_path
|
|
1353
|
+
and "drivers" in folder_path
|
|
1354
|
+
and os.path.exists(folder_path)
|
|
1355
|
+
):
|
|
1356
|
+
shutil.rmtree(folder_path)
|
|
1357
|
+
subprocess.run(
|
|
1358
|
+
["unzip", zip_file_path, "-d", downloads_folder]
|
|
1359
|
+
)
|
|
1360
|
+
elif IS_WINDOWS:
|
|
1361
|
+
subprocess.run(
|
|
1362
|
+
[
|
|
1363
|
+
"powershell",
|
|
1364
|
+
"Expand-Archive",
|
|
1365
|
+
"-Path",
|
|
1366
|
+
zip_file_path,
|
|
1367
|
+
"-DestinationPath",
|
|
1368
|
+
downloads_folder,
|
|
1369
|
+
"-Force",
|
|
1370
|
+
]
|
|
1371
|
+
)
|
|
1372
|
+
else:
|
|
1373
|
+
zip_ref.extractall(downloads_folder)
|
|
1374
|
+
zip_ref.close()
|
|
1375
|
+
with suppress(Exception):
|
|
1376
|
+
os.remove(zip_file_path)
|
|
1377
|
+
log_d("%sUnzip Complete!%s\n" % (c2, cr))
|
|
1378
|
+
pr_base_path = c3 + base_path + cr
|
|
1379
|
+
pr_sep = c3 + os.sep + cr
|
|
1380
|
+
pr_folder_name = c3 + folder_name + cr
|
|
1381
|
+
log_d(
|
|
1382
|
+
"Chromium was saved inside:\n%s%s\n%s\n"
|
|
1383
|
+
% (pr_base_path, pr_sep, pr_folder_name)
|
|
1384
|
+
)
|
|
1256
1385
|
elif name == "chrome-headless-shell" or name == "chs":
|
|
1257
1386
|
# Zip file is valid. Proceed.
|
|
1258
1387
|
driver_path = None
|
|
@@ -1304,6 +1433,7 @@ def main(override=None, intel_for_uc=None, force_uc=None):
|
|
|
1304
1433
|
tar = tarfile.open(file_path)
|
|
1305
1434
|
contents = tar.getnames()
|
|
1306
1435
|
if len(contents) == 1:
|
|
1436
|
+
log_d("%sDownload Complete!%s\n" % (c1, cr))
|
|
1307
1437
|
for f_name in contents:
|
|
1308
1438
|
# Remove existing version if exists
|
|
1309
1439
|
new_file = os.path.join(downloads_folder, str(f_name))
|
|
@@ -1341,6 +1471,7 @@ def main(override=None, intel_for_uc=None, force_uc=None):
|
|
|
1341
1471
|
else:
|
|
1342
1472
|
# Not a .zip file or a .tar.gz file. Just a direct download.
|
|
1343
1473
|
if "Driver" in file_name or "driver" in file_name:
|
|
1474
|
+
log_d("%sDownload Complete!%s\n" % (c1, cr))
|
|
1344
1475
|
log_d("Making [%s] executable ..." % file_name)
|
|
1345
1476
|
make_executable(file_path)
|
|
1346
1477
|
log_d("%s[%s] is now ready for use!%s" % (c1, file_name, cr))
|
|
@@ -22,7 +22,6 @@ Output:
|
|
|
22
22
|
and use a "sky" theme with "slide" transition.
|
|
23
23
|
The chart can be used as a basic boilerplate.
|
|
24
24
|
"""
|
|
25
|
-
import codecs
|
|
26
25
|
import colorama
|
|
27
26
|
import os
|
|
28
27
|
import sys
|
|
@@ -254,7 +253,7 @@ def main():
|
|
|
254
253
|
continue
|
|
255
254
|
new_data.append(line)
|
|
256
255
|
data = new_data
|
|
257
|
-
file =
|
|
256
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
258
257
|
file.writelines("\r\n".join(data))
|
|
259
258
|
file.close()
|
|
260
259
|
if " " not in file_name:
|