seleniumbase 4.43.1__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 -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 +14 -1
- 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 +17 -1
- seleniumbase/core/tour_helper.py +1 -1
- seleniumbase/fixtures/constants.py +11 -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/page_source.py +2 -2
- seleniumbase/plugins/pytest_plugin.py +23 -19
- seleniumbase/translate/translator.py +2 -2
- seleniumbase/undetected/cdp_driver/cdp_util.py +42 -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.2.dist-info}/METADATA +2 -2
- {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.2.dist-info}/RECORD +35 -35
- {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.2.dist-info}/WHEEL +0 -0
- {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.2.dist-info}/entry_points.txt +0 -0
- {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.2.dist-info}/licenses/LICENSE +0 -0
- {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.2.dist-info}/top_level.txt +0 -0
seleniumbase/__version__.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# seleniumbase package
|
|
2
|
-
__version__ = "4.43.
|
|
2
|
+
__version__ = "4.43.2"
|
seleniumbase/behave/behave_sb.py
CHANGED
|
@@ -1216,24 +1216,24 @@ def _create_dashboard_assets_():
|
|
|
1216
1216
|
add_pytest_style_css = True
|
|
1217
1217
|
if os.path.exists(pytest_style_css):
|
|
1218
1218
|
existing_pytest_style = None
|
|
1219
|
-
with open(pytest_style_css, "r") as f:
|
|
1219
|
+
with open(pytest_style_css, mode="r") as f:
|
|
1220
1220
|
existing_pytest_style = f.read()
|
|
1221
1221
|
if existing_pytest_style == get_pytest_style():
|
|
1222
1222
|
add_pytest_style_css = False
|
|
1223
1223
|
if add_pytest_style_css:
|
|
1224
|
-
out_file = open(pytest_style_css, "w+", encoding="utf-8")
|
|
1224
|
+
out_file = open(pytest_style_css, mode="w+", encoding="utf-8")
|
|
1225
1225
|
out_file.writelines(get_pytest_style())
|
|
1226
1226
|
out_file.close()
|
|
1227
1227
|
live_js_file = os.path.join(assets_folder, "live.js")
|
|
1228
1228
|
add_live_js_file = True
|
|
1229
1229
|
if os.path.exists(live_js_file):
|
|
1230
1230
|
existing_live_js = None
|
|
1231
|
-
with open(live_js_file, "r") as f:
|
|
1231
|
+
with open(live_js_file, mode="r") as f:
|
|
1232
1232
|
existing_live_js = f.read()
|
|
1233
1233
|
if existing_live_js == live_js:
|
|
1234
1234
|
add_live_js_file = False
|
|
1235
1235
|
if add_live_js_file:
|
|
1236
|
-
out_file = open(live_js_file, "w+", encoding="utf-8")
|
|
1236
|
+
out_file = open(live_js_file, mode="w+", encoding="utf-8")
|
|
1237
1237
|
out_file.writelines(live_js)
|
|
1238
1238
|
out_file.close()
|
|
1239
1239
|
|
|
@@ -1306,7 +1306,7 @@ def _perform_behave_unconfigure_():
|
|
|
1306
1306
|
# Part 1: Finalizing the dashboard / integrating html report
|
|
1307
1307
|
if os.path.exists(dashboard_path):
|
|
1308
1308
|
the_html_d = None
|
|
1309
|
-
with open(dashboard_path, "r", encoding="utf-8") as f:
|
|
1309
|
+
with open(dashboard_path, mode="r", encoding="utf-8") as f:
|
|
1310
1310
|
the_html_d = f.read()
|
|
1311
1311
|
if sb_config._multithreaded and "-c" in sys.argv:
|
|
1312
1312
|
# Threads have "-c" in sys.argv, except for the last
|
|
@@ -1317,7 +1317,7 @@ def _perform_behave_unconfigure_():
|
|
|
1317
1317
|
if os.path.exists(pie_path):
|
|
1318
1318
|
import json
|
|
1319
1319
|
|
|
1320
|
-
with open(pie_path, "r") as f:
|
|
1320
|
+
with open(pie_path, mode="r") as f:
|
|
1321
1321
|
dash_pie = f.read().strip()
|
|
1322
1322
|
sb_config._saved_dashboard_pie = json.loads(dash_pie)
|
|
1323
1323
|
# If the test run doesn't complete by itself, stop refresh
|
|
@@ -1326,7 +1326,7 @@ def _perform_behave_unconfigure_():
|
|
|
1326
1326
|
the_html_d = the_html_d.replace(find_it_3, swap_with_3)
|
|
1327
1327
|
the_html_d = the_html_d.replace(find_it_4, swap_with_4)
|
|
1328
1328
|
the_html_d += stamp
|
|
1329
|
-
with open(dashboard_path, "w", encoding="utf-8") as f:
|
|
1329
|
+
with open(dashboard_path, mode="w", encoding="utf-8") as f:
|
|
1330
1330
|
f.write(the_html_d) # Finalize the dashboard
|
|
1331
1331
|
except KeyboardInterrupt:
|
|
1332
1332
|
pass
|
|
@@ -134,7 +134,7 @@ def generate_case_plan_boilerplates(
|
|
|
134
134
|
file_name = case_id
|
|
135
135
|
file_path = os.path.join(full_folder_path, file_name)
|
|
136
136
|
if not os.path.exists(file_path):
|
|
137
|
-
out_file = open(file_path, "w+", "utf-8")
|
|
137
|
+
out_file = open(file_path, mode="w+", encoding="utf-8")
|
|
138
138
|
out_file.writelines("\r\n".join(data))
|
|
139
139
|
out_file.close()
|
|
140
140
|
new_plans += 1
|
|
@@ -182,7 +182,7 @@ def view_summary_of_existing_case_plans(root, tests):
|
|
|
182
182
|
else:
|
|
183
183
|
case_path = os.path.join(folder_path, "case_plans", case_id)
|
|
184
184
|
if os.path.exists(case_path):
|
|
185
|
-
f = open(case_path, "r")
|
|
185
|
+
f = open(case_path, mode="r")
|
|
186
186
|
case_data = f.read()
|
|
187
187
|
f.close()
|
|
188
188
|
case_data_storage.append(case_data)
|
|
@@ -315,7 +315,7 @@ def view_summary_of_existing_case_plans(root, tests):
|
|
|
315
315
|
full_plan = plan_head
|
|
316
316
|
|
|
317
317
|
file_path = "case_summary.md"
|
|
318
|
-
file = open(file_path, "w+", "utf-8")
|
|
318
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
319
319
|
file.writelines("\r\n".join(full_plan))
|
|
320
320
|
file.close()
|
|
321
321
|
|
|
@@ -253,7 +253,7 @@ def main():
|
|
|
253
253
|
continue
|
|
254
254
|
new_data.append(line)
|
|
255
255
|
data = new_data
|
|
256
|
-
file = open(file_path, "w+", "utf-8")
|
|
256
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
257
257
|
file.writelines("\r\n".join(data))
|
|
258
258
|
file.close()
|
|
259
259
|
if " " not in file_name:
|
|
@@ -113,7 +113,7 @@ def main():
|
|
|
113
113
|
data.append(seleniumbase_req)
|
|
114
114
|
data.append("")
|
|
115
115
|
file_path = "%s/%s" % (dir_name, "requirements.txt")
|
|
116
|
-
file = open(file_path, "w+", "utf-8")
|
|
116
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
117
117
|
file.writelines("\r\n".join(data))
|
|
118
118
|
file.close()
|
|
119
119
|
|
|
@@ -151,7 +151,7 @@ def main():
|
|
|
151
151
|
data.append(" production: custom marker")
|
|
152
152
|
data.append("")
|
|
153
153
|
file_path = "%s/%s" % (dir_name, "pytest.ini")
|
|
154
|
-
file = open(file_path, "w+", "utf-8")
|
|
154
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
155
155
|
file.writelines("\r\n".join(data))
|
|
156
156
|
file.close()
|
|
157
157
|
|
|
@@ -168,14 +168,14 @@ def main():
|
|
|
168
168
|
data.append("show_skipped=false")
|
|
169
169
|
data.append("show_timings=false")
|
|
170
170
|
file_path = "%s/%s" % (dir_name, "setup.cfg")
|
|
171
|
-
file = open(file_path, "w+", "utf-8")
|
|
171
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
172
172
|
file.writelines("\r\n".join(data))
|
|
173
173
|
file.close()
|
|
174
174
|
|
|
175
175
|
data = []
|
|
176
176
|
data.append("")
|
|
177
177
|
file_path = "%s/%s" % (dir_name, "__init__.py")
|
|
178
|
-
file = open(file_path, "w+", "utf-8")
|
|
178
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
179
179
|
file.writelines("\r\n".join(data))
|
|
180
180
|
file.close()
|
|
181
181
|
|
|
@@ -311,7 +311,7 @@ def main():
|
|
|
311
311
|
data.append("temp_*/")
|
|
312
312
|
data.append("node_modules")
|
|
313
313
|
file_path = "%s/%s" % (dir_name, ".gitignore")
|
|
314
|
-
file = open(file_path, "w+", "utf-8")
|
|
314
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
315
315
|
file.writelines("\r\n".join(data))
|
|
316
316
|
file.close()
|
|
317
317
|
|
|
@@ -323,7 +323,7 @@ def main():
|
|
|
323
323
|
data.append(" ├── requirements.txt")
|
|
324
324
|
data.append(" └── setup.cfg")
|
|
325
325
|
file_path = "%s/%s" % (dir_name, "outline.rst")
|
|
326
|
-
file = open(file_path, "w+", "utf-8")
|
|
326
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
327
327
|
file.writelines("\r\n".join(data))
|
|
328
328
|
file.close()
|
|
329
329
|
os.system("sbase print %s -n" % file_path)
|
|
@@ -367,7 +367,7 @@ def main():
|
|
|
367
367
|
data.append(' self.assert_element("div#login_button_container")')
|
|
368
368
|
data.append("")
|
|
369
369
|
file_path = "%s/%s" % (dir_name, "my_first_test.py")
|
|
370
|
-
file = open(file_path, "w+", "utf-8")
|
|
370
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
371
371
|
file.writelines("\r\n".join(data))
|
|
372
372
|
file.close()
|
|
373
373
|
|
|
@@ -460,7 +460,7 @@ def main():
|
|
|
460
460
|
data.append(' self.assert_text("SeleniumBase", "h2")')
|
|
461
461
|
data.append("")
|
|
462
462
|
file_path = "%s/%s" % (dir_name, "test_demo_site.py")
|
|
463
|
-
file = open(file_path, "w+", "utf-8")
|
|
463
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
464
464
|
file.writelines("\r\n".join(data))
|
|
465
465
|
file.close()
|
|
466
466
|
|
|
@@ -499,7 +499,7 @@ def main():
|
|
|
499
499
|
data.append(' self.assert_title_contains(title_text)')
|
|
500
500
|
data.append("")
|
|
501
501
|
file_path = "%s/%s" % (dir_name, "parameterized_test.py")
|
|
502
|
-
file = open(file_path, "w+", "utf-8")
|
|
502
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
503
503
|
file.writelines("\r\n".join(data))
|
|
504
504
|
file.close()
|
|
505
505
|
|
|
@@ -509,7 +509,7 @@ def main():
|
|
|
509
509
|
data = []
|
|
510
510
|
data.append("")
|
|
511
511
|
file_path = "%s/%s" % (dir_name_2, "__init__.py")
|
|
512
|
-
file = open(file_path, "w+", "utf-8")
|
|
512
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
513
513
|
file.writelines("\r\n".join(data))
|
|
514
514
|
file.close()
|
|
515
515
|
|
|
@@ -544,7 +544,7 @@ def main():
|
|
|
544
544
|
data.append(" pass")
|
|
545
545
|
data.append("")
|
|
546
546
|
file_path = "%s/%s" % (dir_name_2, "base_test_case.py")
|
|
547
|
-
file = open(file_path, "w+", "utf-8")
|
|
547
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
548
548
|
file.writelines("\r\n".join(data))
|
|
549
549
|
file.close()
|
|
550
550
|
|
|
@@ -553,7 +553,7 @@ def main():
|
|
|
553
553
|
data.append(' html = "html"')
|
|
554
554
|
data.append("")
|
|
555
555
|
file_path = "%s/%s" % (dir_name_2, "page_objects.py")
|
|
556
|
-
file = open(file_path, "w+", "utf-8")
|
|
556
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
557
557
|
file.writelines("\r\n".join(data))
|
|
558
558
|
file.close()
|
|
559
559
|
|
|
@@ -569,7 +569,7 @@ def main():
|
|
|
569
569
|
data.append(" self.assert_element(Page.html)")
|
|
570
570
|
data.append("")
|
|
571
571
|
file_path = "%s/%s" % (dir_name_2, "boilerplate_test.py")
|
|
572
|
-
file = open(file_path, "w+", "utf-8")
|
|
572
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
573
573
|
file.writelines("\r\n".join(data))
|
|
574
574
|
file.close()
|
|
575
575
|
|
|
@@ -593,7 +593,7 @@ def main():
|
|
|
593
593
|
data.append(' DataPage().add_input_text(self, "Goodbye!")')
|
|
594
594
|
data.append("")
|
|
595
595
|
file_path = "%s/%s" % (dir_name_2, "classic_obj_test.py")
|
|
596
|
-
file = open(file_path, "w+", "utf-8")
|
|
596
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
597
597
|
file.writelines("\r\n".join(data))
|
|
598
598
|
file.close()
|
|
599
599
|
|
|
@@ -613,7 +613,7 @@ def main():
|
|
|
613
613
|
data.append(' DataPage().add_input_text(sb, "Goodbye!")')
|
|
614
614
|
data.append("")
|
|
615
615
|
file_path = "%s/%s" % (dir_name_2, "sb_fixture_test.py")
|
|
616
|
-
file = open(file_path, "w+", "utf-8")
|
|
616
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
617
617
|
file.writelines("\r\n".join(data))
|
|
618
618
|
file.close()
|
|
619
619
|
|
|
@@ -623,7 +623,7 @@ def main():
|
|
|
623
623
|
data = []
|
|
624
624
|
data.append("")
|
|
625
625
|
file_path = "%s/%s" % (dir_name_3, "__init__.py")
|
|
626
|
-
file = open(file_path, "w+", "utf-8")
|
|
626
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
627
627
|
file.writelines("\r\n".join(data))
|
|
628
628
|
file.close()
|
|
629
629
|
|
|
@@ -651,7 +651,7 @@ def main():
|
|
|
651
651
|
)
|
|
652
652
|
data.append("")
|
|
653
653
|
file_path = "%s/%s" % (dir_name_3, "google_test.py")
|
|
654
|
-
file = open(file_path, "w+", "utf-8")
|
|
654
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
655
655
|
file.writelines("\r\n".join(data))
|
|
656
656
|
file.close()
|
|
657
657
|
|
|
@@ -669,7 +669,7 @@ def main():
|
|
|
669
669
|
data.append(' search_results = "div#center_col"')
|
|
670
670
|
data.append("")
|
|
671
671
|
file_path = "%s/%s" % (dir_name_3, "google_objects.py")
|
|
672
|
-
file = open(file_path, "w+", "utf-8")
|
|
672
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
673
673
|
file.writelines("\r\n".join(data))
|
|
674
674
|
file.close()
|
|
675
675
|
|
|
@@ -701,7 +701,7 @@ def main():
|
|
|
701
701
|
data.append(' self.assert_element("div#login_button_container")')
|
|
702
702
|
data.append("")
|
|
703
703
|
file_path = "%s/%s" % (dir_name_3, "swag_labs_test.py")
|
|
704
|
-
file = open(file_path, "w+", "utf-8")
|
|
704
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
705
705
|
file.writelines("\r\n".join(data))
|
|
706
706
|
file.close()
|
|
707
707
|
|
|
@@ -728,7 +728,7 @@ def main():
|
|
|
728
728
|
data.append(' sb.assert_element("div#login_button_container")')
|
|
729
729
|
data.append("")
|
|
730
730
|
file_path = "%s/%s" % (dir_name_3, "sb_swag_test.py")
|
|
731
|
-
file = open(file_path, "w+", "utf-8")
|
|
731
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
732
732
|
file.writelines("\r\n".join(data))
|
|
733
733
|
file.close()
|
|
734
734
|
|
|
@@ -755,7 +755,7 @@ def main():
|
|
|
755
755
|
data.append(" ├── sb_swag_test.py")
|
|
756
756
|
data.append(" └── swag_labs_test.py")
|
|
757
757
|
file_path = "%s/%s" % (dir_name, "outline.rst")
|
|
758
|
-
file = open(file_path, "w+", "utf-8")
|
|
758
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
759
759
|
file.writelines("\r\n".join(data))
|
|
760
760
|
file.close()
|
|
761
761
|
if " " not in file_path:
|
|
@@ -412,7 +412,7 @@ def main():
|
|
|
412
412
|
continue
|
|
413
413
|
new_data.append(line)
|
|
414
414
|
data = new_data
|
|
415
|
-
file = open(file_path, "w+", "utf-8")
|
|
415
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
416
416
|
file.writelines("\r\n".join(data))
|
|
417
417
|
file.close()
|
|
418
418
|
if " " not in file_name:
|
|
@@ -272,7 +272,7 @@ def main():
|
|
|
272
272
|
continue
|
|
273
273
|
new_data.append(line)
|
|
274
274
|
data = new_data
|
|
275
|
-
file = open(file_path, "w+", "utf-8")
|
|
275
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
276
276
|
file.writelines("\r\n".join(data))
|
|
277
277
|
file.close()
|
|
278
278
|
if " " not in file_name:
|
|
@@ -135,7 +135,7 @@ def create_objects_file(selector_list_dict=None):
|
|
|
135
135
|
data.append(' html = "html"')
|
|
136
136
|
data.append("")
|
|
137
137
|
file_path = PAGE_OBJECTS_FILE
|
|
138
|
-
file = open(file_path, "w+", "utf-8")
|
|
138
|
+
file = open(file_path, mode="w+", encoding="utf-8")
|
|
139
139
|
file.writelines("\r\n".join(data))
|
|
140
140
|
file.close()
|
|
141
141
|
if not selector_list_dict:
|
|
@@ -149,7 +149,7 @@ def scan_objects_file():
|
|
|
149
149
|
create_objects_file()
|
|
150
150
|
|
|
151
151
|
page_selectors = {}
|
|
152
|
-
with open(PAGE_OBJECTS_FILE, "r", encoding="utf-8") as f:
|
|
152
|
+
with open(PAGE_OBJECTS_FILE, mode="r", encoding="utf-8") as f:
|
|
153
153
|
all_code = f.read()
|
|
154
154
|
|
|
155
155
|
var_names = []
|
|
@@ -3089,7 +3089,7 @@ def main(shell_command):
|
|
|
3089
3089
|
"Expecting: %s\n" % (seleniumbase_file, expected_arg)
|
|
3090
3090
|
)
|
|
3091
3091
|
|
|
3092
|
-
with open(seleniumbase_file, "r", encoding="utf-8") as f:
|
|
3092
|
+
with open(seleniumbase_file, mode="r", encoding="utf-8") as f:
|
|
3093
3093
|
all_code = f.read()
|
|
3094
3094
|
if "def test_" not in all_code:
|
|
3095
3095
|
raise Exception(
|
|
@@ -3188,7 +3188,7 @@ def main(shell_command):
|
|
|
3188
3188
|
# Create SeleniumBase test file
|
|
3189
3189
|
base_file_name = seleniumbase_file.split(".py")[0]
|
|
3190
3190
|
converted_file_name = base_file_name + ".py" # Change end to make a copy
|
|
3191
|
-
out_file = open(converted_file_name, "w+", encoding="utf-8")
|
|
3191
|
+
out_file = open(converted_file_name, mode="w+", encoding="utf-8")
|
|
3192
3192
|
out_file.writelines(seleniumbase_code)
|
|
3193
3193
|
out_file.close()
|
|
3194
3194
|
print('\n>>> ["%s"] was updated!\n' % converted_file_name)
|
|
@@ -123,7 +123,7 @@ def main():
|
|
|
123
123
|
|
|
124
124
|
all_code = None
|
|
125
125
|
with open(
|
|
126
|
-
file_to_print, "r+", encoding="utf-8", errors="ignore"
|
|
126
|
+
file_to_print, mode="r+", encoding="utf-8", errors="ignore"
|
|
127
127
|
) as f:
|
|
128
128
|
all_code = f.read()
|
|
129
129
|
all_code = all_code.replace("\t", " ")
|
|
@@ -2011,7 +2011,7 @@ def _mark_driver_repaired():
|
|
|
2011
2011
|
file_path = os.path.join(abs_path, driver_repaired_lock)
|
|
2012
2012
|
if not os.path.exists(DOWNLOADS_FOLDER):
|
|
2013
2013
|
os.makedirs(DOWNLOADS_FOLDER)
|
|
2014
|
-
out_file = open(file_path, "w+", encoding="utf-8")
|
|
2014
|
+
out_file = open(file_path, mode="w+", encoding="utf-8")
|
|
2015
2015
|
out_file.writelines("")
|
|
2016
2016
|
out_file.close()
|
|
2017
2017
|
|
|
@@ -2396,6 +2396,19 @@ def _set_chrome_options(
|
|
|
2396
2396
|
and not recorder_ext
|
|
2397
2397
|
and (not extension_zip and not extension_dir)
|
|
2398
2398
|
):
|
|
2399
|
+
if (
|
|
2400
|
+
binary_location
|
|
2401
|
+
and isinstance(binary_location, str)
|
|
2402
|
+
and (
|
|
2403
|
+
binary_location.lower().endswith("comet")
|
|
2404
|
+
or binary_location.lower().endswith("comet.exe")
|
|
2405
|
+
or binary_location.lower().endswith("atlas")
|
|
2406
|
+
or binary_location.lower().endswith("atlas.exe")
|
|
2407
|
+
)
|
|
2408
|
+
):
|
|
2409
|
+
# AI browsers don't like Incognito / Guest Mode
|
|
2410
|
+
incognito = False
|
|
2411
|
+
guest_mode = False
|
|
2399
2412
|
if incognito:
|
|
2400
2413
|
# Use Chrome's Incognito Mode
|
|
2401
2414
|
# Incognito Mode prevents Chrome extensions from loading,
|
|
@@ -40,6 +40,10 @@ class OSType(object):
|
|
|
40
40
|
class ChromeType(object):
|
|
41
41
|
GOOGLE = "google-chrome"
|
|
42
42
|
MSEDGE = "edge"
|
|
43
|
+
OPERA = "opera"
|
|
44
|
+
BRAVE = "brave"
|
|
45
|
+
COMET = "comet"
|
|
46
|
+
ATLAS = "atlas"
|
|
43
47
|
|
|
44
48
|
|
|
45
49
|
PATTERN = {
|
|
@@ -96,7 +100,9 @@ def linux_browser_apps_to_cmd(*apps):
|
|
|
96
100
|
)
|
|
97
101
|
|
|
98
102
|
|
|
99
|
-
def chrome_on_linux_path(chromium_ok=False):
|
|
103
|
+
def chrome_on_linux_path(chromium_ok=False, browser_type=None):
|
|
104
|
+
if browser_type and browser_type != ChromeType.GOOGLE:
|
|
105
|
+
return ""
|
|
100
106
|
if os_name() != OSType.LINUX:
|
|
101
107
|
return ""
|
|
102
108
|
paths = ["/bin/google-chrome", "/bin/google-chrome-stable"]
|
|
@@ -126,7 +132,9 @@ def chrome_on_linux_path(chromium_ok=False):
|
|
|
126
132
|
return "/usr/bin/google-chrome"
|
|
127
133
|
|
|
128
134
|
|
|
129
|
-
def edge_on_linux_path():
|
|
135
|
+
def edge_on_linux_path(browser_type=None):
|
|
136
|
+
if browser_type and browser_type != ChromeType.MSEDGE:
|
|
137
|
+
return ""
|
|
130
138
|
if os_name() != OSType.LINUX:
|
|
131
139
|
return ""
|
|
132
140
|
paths = os.environ["PATH"].split(os.pathsep)
|
|
@@ -143,7 +151,60 @@ def edge_on_linux_path():
|
|
|
143
151
|
return "/usr/bin/microsoft-edge"
|
|
144
152
|
|
|
145
153
|
|
|
146
|
-
def
|
|
154
|
+
def opera_on_linux_path(browser_type=None):
|
|
155
|
+
if browser_type and browser_type != ChromeType.OPERA:
|
|
156
|
+
return ""
|
|
157
|
+
if os_name() != OSType.LINUX:
|
|
158
|
+
return ""
|
|
159
|
+
paths = os.environ["PATH"].split(os.pathsep)
|
|
160
|
+
binaries = []
|
|
161
|
+
binaries.append("opera")
|
|
162
|
+
binaries.append("opera-stable")
|
|
163
|
+
for binary in binaries:
|
|
164
|
+
for path in paths:
|
|
165
|
+
full_path = os.path.join(path, binary)
|
|
166
|
+
if os.path.exists(full_path) and os.access(full_path, os.X_OK):
|
|
167
|
+
return full_path
|
|
168
|
+
return "/usr/bin/opera-stable"
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def brave_on_linux_path(browser_type=None):
|
|
172
|
+
if browser_type and browser_type != ChromeType.BRAVE:
|
|
173
|
+
return ""
|
|
174
|
+
if os_name() != OSType.LINUX:
|
|
175
|
+
return ""
|
|
176
|
+
paths = os.environ["PATH"].split(os.pathsep)
|
|
177
|
+
binaries = []
|
|
178
|
+
binaries.append("brave-browser")
|
|
179
|
+
binaries.append("brave")
|
|
180
|
+
binaries.append("brave-browser-stable")
|
|
181
|
+
for binary in binaries:
|
|
182
|
+
for path in paths:
|
|
183
|
+
full_path = os.path.join(path, binary)
|
|
184
|
+
if os.path.exists(full_path) and os.access(full_path, os.X_OK):
|
|
185
|
+
return full_path
|
|
186
|
+
return "/usr/bin/brave-browser"
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def comet_on_linux_path(browser_type=None):
|
|
190
|
+
if browser_type and browser_type != ChromeType.COMET:
|
|
191
|
+
return ""
|
|
192
|
+
if os_name() != OSType.LINUX:
|
|
193
|
+
return ""
|
|
194
|
+
return "" # Comet Browser isn't supported on Linux yet
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def atlas_on_linux_path(browser_type=None):
|
|
198
|
+
if browser_type and browser_type != ChromeType.ATLAS:
|
|
199
|
+
return ""
|
|
200
|
+
if os_name() != OSType.LINUX:
|
|
201
|
+
return ""
|
|
202
|
+
return "" # Atlas Browser isn't supported on Linux yet
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def chrome_on_windows_path(browser_type=None):
|
|
206
|
+
if browser_type and browser_type != ChromeType.GOOGLE:
|
|
207
|
+
return ""
|
|
147
208
|
if os_name() != OSType.WIN:
|
|
148
209
|
return ""
|
|
149
210
|
candidates = []
|
|
@@ -171,7 +232,9 @@ def chrome_on_windows_path():
|
|
|
171
232
|
return ""
|
|
172
233
|
|
|
173
234
|
|
|
174
|
-
def edge_on_windows_path():
|
|
235
|
+
def edge_on_windows_path(browser_type=None):
|
|
236
|
+
if browser_type and browser_type != ChromeType.MSEDGE:
|
|
237
|
+
return ""
|
|
175
238
|
if os_name() != OSType.WIN:
|
|
176
239
|
return ""
|
|
177
240
|
candidates = []
|
|
@@ -199,6 +262,119 @@ def edge_on_windows_path():
|
|
|
199
262
|
return ""
|
|
200
263
|
|
|
201
264
|
|
|
265
|
+
def opera_on_windows_path(browser_type=None):
|
|
266
|
+
if browser_type and browser_type != ChromeType.OPERA:
|
|
267
|
+
return ""
|
|
268
|
+
if os_name() != OSType.WIN:
|
|
269
|
+
return ""
|
|
270
|
+
candidates = []
|
|
271
|
+
for item in map(
|
|
272
|
+
os.environ.get,
|
|
273
|
+
(
|
|
274
|
+
"PROGRAMFILES",
|
|
275
|
+
"PROGRAMFILES(X86)",
|
|
276
|
+
"LOCALAPPDATA",
|
|
277
|
+
"PROGRAMW6432",
|
|
278
|
+
),
|
|
279
|
+
):
|
|
280
|
+
for subitem in (
|
|
281
|
+
"Opera",
|
|
282
|
+
"Opera/Application",
|
|
283
|
+
):
|
|
284
|
+
try:
|
|
285
|
+
candidates.append(os.sep.join((item, subitem, "launcher.exe")))
|
|
286
|
+
except TypeError:
|
|
287
|
+
pass
|
|
288
|
+
for candidate in candidates:
|
|
289
|
+
if os.path.exists(candidate) and os.access(candidate, os.X_OK):
|
|
290
|
+
return os.path.normpath(candidate)
|
|
291
|
+
return ""
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
def brave_on_windows_path(browser_type=None):
|
|
295
|
+
if browser_type and browser_type != ChromeType.BRAVE:
|
|
296
|
+
return ""
|
|
297
|
+
if os_name() != OSType.WIN:
|
|
298
|
+
return ""
|
|
299
|
+
candidates = []
|
|
300
|
+
for item in map(
|
|
301
|
+
os.environ.get,
|
|
302
|
+
(
|
|
303
|
+
"PROGRAMFILES",
|
|
304
|
+
"PROGRAMFILES(X86)",
|
|
305
|
+
"LOCALAPPDATA",
|
|
306
|
+
"PROGRAMW6432",
|
|
307
|
+
),
|
|
308
|
+
):
|
|
309
|
+
for subitem in (
|
|
310
|
+
"BraveSoftware/Brave-Browser/Application",
|
|
311
|
+
):
|
|
312
|
+
try:
|
|
313
|
+
candidates.append(os.sep.join((item, subitem, "brave.exe")))
|
|
314
|
+
except TypeError:
|
|
315
|
+
pass
|
|
316
|
+
for candidate in candidates:
|
|
317
|
+
if os.path.exists(candidate) and os.access(candidate, os.X_OK):
|
|
318
|
+
return os.path.normpath(candidate)
|
|
319
|
+
return ""
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
def comet_on_windows_path(browser_type=None):
|
|
323
|
+
if browser_type and browser_type != ChromeType.COMET:
|
|
324
|
+
return ""
|
|
325
|
+
if os_name() != OSType.WIN:
|
|
326
|
+
return ""
|
|
327
|
+
candidates = []
|
|
328
|
+
for item in map(
|
|
329
|
+
os.environ.get,
|
|
330
|
+
(
|
|
331
|
+
"PROGRAMFILES",
|
|
332
|
+
"PROGRAMFILES(X86)",
|
|
333
|
+
"LOCALAPPDATA",
|
|
334
|
+
"PROGRAMW6432",
|
|
335
|
+
),
|
|
336
|
+
):
|
|
337
|
+
for subitem in (
|
|
338
|
+
"Comet/Application",
|
|
339
|
+
):
|
|
340
|
+
try:
|
|
341
|
+
candidates.append(os.sep.join((item, subitem, "Comet.exe")))
|
|
342
|
+
except TypeError:
|
|
343
|
+
pass
|
|
344
|
+
for candidate in candidates:
|
|
345
|
+
if os.path.exists(candidate) and os.access(candidate, os.X_OK):
|
|
346
|
+
return os.path.normpath(candidate)
|
|
347
|
+
return ""
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
def atlas_on_windows_path(browser_type=None):
|
|
351
|
+
if browser_type and browser_type != ChromeType.ATLAS:
|
|
352
|
+
return ""
|
|
353
|
+
if os_name() != OSType.WIN:
|
|
354
|
+
return ""
|
|
355
|
+
candidates = []
|
|
356
|
+
for item in map(
|
|
357
|
+
os.environ.get,
|
|
358
|
+
(
|
|
359
|
+
"PROGRAMFILES",
|
|
360
|
+
"PROGRAMFILES(X86)",
|
|
361
|
+
"LOCALAPPDATA",
|
|
362
|
+
"PROGRAMW6432",
|
|
363
|
+
),
|
|
364
|
+
):
|
|
365
|
+
for subitem in (
|
|
366
|
+
"Atlas/Application",
|
|
367
|
+
):
|
|
368
|
+
try:
|
|
369
|
+
candidates.append(os.sep.join((item, subitem, "Atlas.exe")))
|
|
370
|
+
except TypeError:
|
|
371
|
+
pass
|
|
372
|
+
for candidate in candidates:
|
|
373
|
+
if os.path.exists(candidate) and os.access(candidate, os.X_OK):
|
|
374
|
+
return os.path.normpath(candidate)
|
|
375
|
+
return ""
|
|
376
|
+
|
|
377
|
+
|
|
202
378
|
def windows_browser_apps_to_cmd(*apps):
|
|
203
379
|
"""Create analogue of browser --version command for windows."""
|
|
204
380
|
powershell = determine_powershell()
|
|
@@ -211,18 +387,48 @@ def windows_browser_apps_to_cmd(*apps):
|
|
|
211
387
|
|
|
212
388
|
def get_binary_location(browser_type, chromium_ok=False):
|
|
213
389
|
"""Return the full path of the browser binary."""
|
|
390
|
+
if browser_type.lower() == "chrome":
|
|
391
|
+
browser_type = "google-chrome"
|
|
392
|
+
elif browser_type.lower() == "msedge":
|
|
393
|
+
browser_type = "edge"
|
|
394
|
+
else:
|
|
395
|
+
browser_type = browser_type.lower()
|
|
214
396
|
cmd_mapping = {
|
|
215
397
|
ChromeType.GOOGLE: {
|
|
216
|
-
OSType.LINUX: chrome_on_linux_path(chromium_ok),
|
|
398
|
+
OSType.LINUX: chrome_on_linux_path(chromium_ok, browser_type),
|
|
217
399
|
OSType.MAC: r"/Applications/Google Chrome.app"
|
|
218
400
|
r"/Contents/MacOS/Google Chrome",
|
|
219
|
-
OSType.WIN: chrome_on_windows_path(),
|
|
401
|
+
OSType.WIN: chrome_on_windows_path(browser_type),
|
|
220
402
|
},
|
|
221
403
|
ChromeType.MSEDGE: {
|
|
222
|
-
OSType.LINUX: edge_on_linux_path(),
|
|
404
|
+
OSType.LINUX: edge_on_linux_path(browser_type),
|
|
223
405
|
OSType.MAC: r"/Applications/Microsoft Edge.app"
|
|
224
406
|
r"/Contents/MacOS/Microsoft Edge",
|
|
225
|
-
OSType.WIN: edge_on_windows_path(),
|
|
407
|
+
OSType.WIN: edge_on_windows_path(browser_type),
|
|
408
|
+
},
|
|
409
|
+
ChromeType.OPERA: {
|
|
410
|
+
OSType.LINUX: opera_on_linux_path(browser_type),
|
|
411
|
+
OSType.MAC: r"/Applications/Opera.app"
|
|
412
|
+
r"/Contents/MacOS/Opera",
|
|
413
|
+
OSType.WIN: opera_on_windows_path(browser_type),
|
|
414
|
+
},
|
|
415
|
+
ChromeType.BRAVE: {
|
|
416
|
+
OSType.LINUX: brave_on_linux_path(browser_type),
|
|
417
|
+
OSType.MAC: r"/Applications/Brave Browser.app"
|
|
418
|
+
r"/Contents/MacOS/Brave Browser",
|
|
419
|
+
OSType.WIN: brave_on_windows_path(browser_type),
|
|
420
|
+
},
|
|
421
|
+
ChromeType.COMET: {
|
|
422
|
+
OSType.LINUX: comet_on_linux_path(browser_type),
|
|
423
|
+
OSType.MAC: r"/Applications/Comet.app"
|
|
424
|
+
r"/Contents/MacOS/Comet",
|
|
425
|
+
OSType.WIN: comet_on_windows_path(browser_type),
|
|
426
|
+
},
|
|
427
|
+
ChromeType.ATLAS: {
|
|
428
|
+
OSType.LINUX: atlas_on_linux_path(browser_type),
|
|
429
|
+
OSType.MAC: r"/Applications/Atlas.app"
|
|
430
|
+
r"/Contents/MacOS/Atlas",
|
|
431
|
+
OSType.WIN: atlas_on_windows_path(browser_type),
|
|
226
432
|
},
|
|
227
433
|
}
|
|
228
434
|
return cmd_mapping[browser_type][os_name()]
|