Skip to content

Commit 5aadf34

Browse files
committed
Fix the Recorder
1 parent 91fb216 commit 5aadf34

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4694,7 +4694,7 @@ def save_cookies(self, name="cookies.txt"):
46944694
if not os.path.exists(file_path):
46954695
os.makedirs(file_path)
46964696
cookies_file_path = os.path.join(file_path, name)
4697-
cookies_file = open(cookies_file_path, "w+", encoding="utf-8")
4697+
cookies_file = open(cookies_file_path, mode="w+", encoding="utf-8")
46984698
cookies_file.writelines(json_cookies)
46994699
cookies_file.close()
47004700

@@ -5751,7 +5751,7 @@ def __process_recorded_actions(self):
57515751
extra_file_name = "__init__.py"
57525752
extra_file_path = os.path.join(recordings_folder, extra_file_name)
57535753
if not os.path.exists(extra_file_path):
5754-
out_file = open(extra_file_path, "w+", "utf-8")
5754+
out_file = open(extra_file_path, mode="w+", encoding="utf-8")
57555755
out_file.writelines("\r\n".join(data))
57565756
out_file.close()
57575757
sys.stdout.write("\nCreated recordings%s__init__.py" % os.sep)
@@ -5799,7 +5799,7 @@ def __process_recorded_actions(self):
57995799
extra_file_name = "pytest.ini"
58005800
extra_file_path = os.path.join(recordings_folder, extra_file_name)
58015801
if not os.path.exists(extra_file_path):
5802-
out_file = open(extra_file_path, "w+", "utf-8")
5802+
out_file = open(extra_file_path, mode="w+", encoding="utf-8")
58035803
out_file.writelines("\r\n".join(data))
58045804
out_file.close()
58055805
sys.stdout.write("\nCreated recordings%spytest.ini" % os.sep)
@@ -5820,7 +5820,7 @@ def __process_recorded_actions(self):
58205820
extra_file_name = "setup.cfg"
58215821
extra_file_path = os.path.join(recordings_folder, extra_file_name)
58225822
if not os.path.exists(extra_file_path):
5823-
out_file = open(extra_file_path, "w+", "utf-8")
5823+
out_file = open(extra_file_path, mode="w+", encoding="utf-8")
58245824
out_file.writelines("\r\n".join(data))
58255825
out_file.close()
58265826
sys.stdout.write("\nCreated recordings%ssetup.cfg" % os.sep)
@@ -5838,7 +5838,7 @@ def __process_recorded_actions(self):
58385838
elif context_filename:
58395839
file_name = context_filename
58405840
file_path = os.path.join(recordings_folder, file_name)
5841-
out_file = open(file_path, "w+", "utf-8")
5841+
out_file = open(file_path, mode="w+", encoding="utf-8")
58425842
out_file.writelines("\r\n".join(data))
58435843
out_file.close()
58445844
rec_message = ">>> RECORDING SAVED as: "
@@ -5940,7 +5940,7 @@ def __process_recorded_behave_actions(self, srt_actions, colorama):
59405940
file_name = sb_config.behave_scenario.filename.replace(".", "_")
59415941
file_name = file_name.split("/")[-1].split("\\")[-1] + "_rec.feature"
59425942
file_path = os.path.join(features_folder, file_name)
5943-
out_file = open(file_path, "w+", "utf-8")
5943+
out_file = open(file_path, mode="w+", encoding="utf-8")
59445944
out_file.writelines("\r\n".join(data))
59455945
out_file.close()
59465946

@@ -5978,7 +5978,7 @@ def __process_recorded_behave_actions(self, srt_actions, colorama):
59785978
file_name = "__init__.py"
59795979
file_path = os.path.join(features_folder, file_name)
59805980
if not os.path.exists(file_path):
5981-
out_file = open(file_path, "w+", "utf-8")
5981+
out_file = open(file_path, mode="w+", encoding="utf-8")
59825982
out_file.writelines("\r\n".join(data))
59835983
out_file.close()
59845984
print("Created recordings/features/__init__.py")
@@ -5991,7 +5991,7 @@ def __process_recorded_behave_actions(self, srt_actions, colorama):
59915991
file_name = "behave.ini"
59925992
file_path = os.path.join(features_folder, file_name)
59935993
if not os.path.exists(file_path):
5994-
out_file = open(file_path, "w+", "utf-8")
5994+
out_file = open(file_path, mode="w+", encoding="utf-8")
59955995
out_file.writelines("\r\n".join(data))
59965996
out_file.close()
59975997
print("Created recordings/features/behave.ini")
@@ -6030,7 +6030,7 @@ def __process_recorded_behave_actions(self, srt_actions, colorama):
60306030
file_name = "environment.py"
60316031
file_path = os.path.join(features_folder, file_name)
60326032
if not os.path.exists(file_path):
6033-
out_file = open(file_path, "w+", "utf-8")
6033+
out_file = open(file_path, mode="w+", encoding="utf-8")
60346034
out_file.writelines("\r\n".join(data))
60356035
out_file.close()
60366036
print("Created recordings/features/environment.py")
@@ -6040,7 +6040,7 @@ def __process_recorded_behave_actions(self, srt_actions, colorama):
60406040
file_name = "__init__.py"
60416041
file_path = os.path.join(steps_folder, file_name)
60426042
if not os.path.exists(file_path):
6043-
out_file = open(file_path, "w+", "utf-8")
6043+
out_file = open(file_path, mode="w+", encoding="utf-8")
60446044
out_file.writelines("\r\n".join(data))
60456045
out_file.close()
60466046
print("Created recordings/features/steps/__init__.py")
@@ -6051,7 +6051,7 @@ def __process_recorded_behave_actions(self, srt_actions, colorama):
60516051
file_name = "imported.py"
60526052
file_path = os.path.join(steps_folder, file_name)
60536053
if not os.path.exists(file_path):
6054-
out_file = open(file_path, "w+", "utf-8")
6054+
out_file = open(file_path, mode="w+", encoding="utf-8")
60556055
out_file.writelines("\r\n".join(data))
60566056
out_file.close()
60576057
print("Created recordings/features/steps/imported.py")
@@ -11120,7 +11120,7 @@ def __process_visual_baseline_logs(self):
1112011120
return # Skip the rest when deferred visual asserts are used
1112111121
the_html = visual_helper.get_sbs_html()
1112211122
file_path = os.path.join(test_logpath, constants.SideBySide.HTML_FILE)
11123-
out_file = open(file_path, "w+", encoding="utf-8")
11123+
out_file = open(file_path, mode="w+", encoding="utf-8")
1112411124
out_file.writelines(the_html)
1112511125
out_file.close()
1112611126

@@ -11280,16 +11280,16 @@ def check_window(
1128011280
self.save_screenshot(
1128111281
baseline_png, visual_baseline_path, selector="body"
1128211282
)
11283-
out_file = open(page_url_file, "w+", encoding="utf-8")
11283+
out_file = open(page_url_file, mode="w+", encoding="utf-8")
1128411284
out_file.writelines(page_url)
1128511285
out_file.close()
11286-
out_file = open(level_1_file, "w+", encoding="utf-8")
11286+
out_file = open(level_1_file, mode="w+", encoding="utf-8")
1128711287
out_file.writelines(json.dumps(level_1))
1128811288
out_file.close()
11289-
out_file = open(level_2_file, "w+", encoding="utf-8")
11289+
out_file = open(level_2_file, mode="w+", encoding="utf-8")
1129011290
out_file.writelines(json.dumps(level_2))
1129111291
out_file.close()
11292-
out_file = open(level_3_file, "w+", encoding="utf-8")
11292+
out_file = open(level_3_file, mode="w+", encoding="utf-8")
1129311293
out_file.writelines(json.dumps(level_3))
1129411294
out_file.close()
1129511295

@@ -11428,7 +11428,7 @@ def check_window(
1142811428
alpha_n_d_name = "".join([x if x.isalnum() else "_" for x in name])
1142911429
side_by_side_name = "side_by_side_%s.html" % alpha_n_d_name
1143011430
file_path = os.path.join(test_logpath, side_by_side_name)
11431-
out_file = open(file_path, "w+", encoding="utf-8")
11431+
out_file = open(file_path, mode="w+", encoding="utf-8")
1143211432
out_file.writelines(the_html)
1143311433
out_file.close()
1143411434

@@ -12120,7 +12120,7 @@ def save_presentation(
1212012120
with suppress(Exception):
1212112121
os.makedirs(saved_presentations_folder)
1212212122
file_path = os.path.join(saved_presentations_folder, filename)
12123-
out_file = open(file_path, "w+", encoding="utf-8")
12123+
out_file = open(file_path, mode="w+", encoding="utf-8")
1212412124
out_file.writelines(the_html)
1212512125
out_file.close()
1212612126
if self._output_file_saves:
@@ -12815,7 +12815,7 @@ def save_chart(self, chart_name=None, filename=None, folder=None):
1281512815
with suppress(Exception):
1281612816
os.makedirs(saved_charts_folder)
1281712817
file_path = os.path.join(saved_charts_folder, filename)
12818-
out_file = open(file_path, "w+", encoding="utf-8")
12818+
out_file = open(file_path, mode="w+", encoding="utf-8")
1281912819
out_file.writelines(the_html)
1282012820
out_file.close()
1282112821
if self._output_file_saves:
@@ -16378,7 +16378,7 @@ def __process_dashboard(self, has_exception, init=False):
1637816378
dash_pie = json.dumps(sb_config._saved_dashboard_pie)
1637916379
dash_pie_loc = constants.Dashboard.DASH_PIE
1638016380
pie_path = os.path.join(abs_path, dash_pie_loc)
16381-
pie_file = open(pie_path, "w+", encoding="utf-8")
16381+
pie_file = open(pie_path, mode="w+", encoding="utf-8")
1638216382
pie_file.writelines(dash_pie)
1638316383
pie_file.close()
1638416384
DASH_PIE_PNG_1 = constants.Dashboard.get_dash_pie_1()
@@ -16538,7 +16538,7 @@ def __process_dashboard(self, has_exception, init=False):
1653816538
)
1653916539
abs_path = os.path.abspath(".")
1654016540
file_path = os.path.join(abs_path, "dashboard.html")
16541-
out_file = open(file_path, "w+", encoding="utf-8")
16541+
out_file = open(file_path, mode="w+", encoding="utf-8")
1654216542
out_file.writelines(the_html)
1654316543
out_file.close()
1654416544
sb_config._dash_html = the_html
@@ -16551,7 +16551,7 @@ def __process_dashboard(self, has_exception, init=False):
1655116551
dash_json = json.dumps((_results, _display_id, _rt, _tlp, d_stats))
1655216552
dash_json_loc = constants.Dashboard.DASH_JSON
1655316553
dash_jsonpath = os.path.join(abs_path, dash_json_loc)
16554-
dash_json_file = open(dash_jsonpath, "w+", encoding="utf-8")
16554+
dash_json_file = open(dash_jsonpath, mode="w+", encoding="utf-8")
1655516555
dash_json_file.writelines(dash_json)
1655616556
dash_json_file.close()
1655716557

0 commit comments

Comments
 (0)