Skip to content

Commit 6b33484

Browse files
committed
Add option to record self.sleep() calls with the Recorder
1 parent f6830c8 commit 6b33484

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3407,6 +3407,15 @@ def sleep(self, seconds):
34073407
if now_ms >= stop_ms:
34083408
break
34093409
time.sleep(0.2)
3410+
if (
3411+
self.recorder_mode
3412+
and hasattr(sb_config, "record_sleep")
3413+
and sb_config.record_sleep
3414+
):
3415+
time_stamp = self.execute_script("return Date.now();")
3416+
origin = self.get_origin()
3417+
action = ["sleep", seconds, origin, time_stamp]
3418+
self.__extra_actions.append(action)
34103419

34113420
def install_addon(self, xpi_file):
34123421
"""Installs a Firefox add-on instantly at run-time.
@@ -3759,6 +3768,7 @@ def __process_recorded_actions(self):
37593768
ext_actions.append("sw_pf")
37603769
ext_actions.append("s_c_f")
37613770
ext_actions.append("s_c_d")
3771+
ext_actions.append("sleep")
37623772
ext_actions.append("sh_fc")
37633773
ext_actions.append("c_l_s")
37643774
ext_actions.append("c_s_s")
@@ -4010,6 +4020,9 @@ def __process_recorded_actions(self):
40104020
sb_actions.append("self.%s()" % method)
40114021
else:
40124022
sb_actions.append("self.%s()" % method)
4023+
elif action[0] == "sleep":
4024+
method = "sleep"
4025+
sb_actions.append("self.%s(%s)" % (method, action[1]))
40134026
elif action[0] == "as_el":
40144027
method = "assert_element"
40154028
if '"' not in action[1]:

0 commit comments

Comments
 (0)