@@ -3763,6 +3763,7 @@ def __process_recorded_actions(self):
3763
3763
ext_actions.append("as_at")
3764
3764
ext_actions.append("as_te")
3765
3765
ext_actions.append("as_et")
3766
+ ext_actions.append("wf_el")
3766
3767
ext_actions.append("sw_fr")
3767
3768
ext_actions.append("sw_dc")
3768
3769
ext_actions.append("sw_pf")
@@ -3775,6 +3776,11 @@ def __process_recorded_actions(self):
3775
3776
ext_actions.append("d_a_c")
3776
3777
ext_actions.append("e_mfa")
3777
3778
ext_actions.append("ss_tl")
3779
+ ext_actions.append("da_el")
3780
+ ext_actions.append("da_ep")
3781
+ ext_actions.append("da_te")
3782
+ ext_actions.append("da_et")
3783
+ ext_actions.append("pr_da")
3778
3784
for n in range(len(srt_actions)):
3779
3785
if srt_actions[n][0] in ext_actions:
3780
3786
origin = srt_actions[n][2]
@@ -4023,6 +4029,12 @@ def __process_recorded_actions(self):
4023
4029
elif action[0] == "sleep":
4024
4030
method = "sleep"
4025
4031
sb_actions.append("self.%s(%s)" % (method, action[1]))
4032
+ elif action[0] == "wf_el":
4033
+ method = "wait_for_element"
4034
+ if '"' not in action[1]:
4035
+ sb_actions.append('self.%s("%s")' % (method, action[1]))
4036
+ else:
4037
+ sb_actions.append("self.%s('%s')" % (method, action[1]))
4026
4038
elif action[0] == "as_el":
4027
4039
method = "assert_element"
4028
4040
if '"' not in action[1]:
@@ -4097,13 +4109,22 @@ def __process_recorded_actions(self):
4097
4109
'self.%s(\'%s\', "%s")'
4098
4110
% (method, action[1][0], action[1][1])
4099
4111
)
4100
- elif action[0] == "as_te" or action[0] == "as_et":
4112
+ elif (
4113
+ action[0] == "as_te"
4114
+ or action[0] == "as_et"
4115
+ or action[0] == "da_te"
4116
+ or action[0] == "da_et"
4117
+ ):
4101
4118
import unicodedata
4102
4119
4103
4120
action[1][0] = unicodedata.normalize("NFKC", action[1][0])
4104
4121
method = "assert_text"
4105
4122
if action[0] == "as_et":
4106
4123
method = "assert_exact_text"
4124
+ elif action[0] == "da_te":
4125
+ method = "deferred_assert_text"
4126
+ elif action[0] == "da_et":
4127
+ method = "deferred_assert_exact_text"
4107
4128
if action[1][1] != "html":
4108
4129
if '"' not in action[1][0] and '"' not in action[1][1]:
4109
4130
sb_actions.append(
@@ -4134,12 +4155,26 @@ def __process_recorded_actions(self):
4134
4155
sb_actions.append(
4135
4156
"self.%s('%s')" % (method, action[1][0])
4136
4157
)
4158
+ elif action[0] == "da_el":
4159
+ method = "deferred_assert_element"
4160
+ if '"' not in action[1]:
4161
+ sb_actions.append('self.%s("%s")' % (method, action[1]))
4162
+ else:
4163
+ sb_actions.append("self.%s('%s')" % (method, action[1]))
4164
+ elif action[0] == "da_ep":
4165
+ method = "deferred_assert_element_present"
4166
+ if '"' not in action[1]:
4167
+ sb_actions.append('self.%s("%s")' % (method, action[1]))
4168
+ else:
4169
+ sb_actions.append("self.%s('%s')" % (method, action[1]))
4137
4170
elif action[0] == "ss_tl":
4138
4171
method = "save_screenshot_to_logs"
4139
4172
sb_actions.append("self.%s()" % method)
4140
4173
elif action[0] == "sh_fc":
4141
4174
method = "show_file_choosers"
4142
4175
sb_actions.append("self.%s()" % method)
4176
+ elif action[0] == "pr_da":
4177
+ sb_actions.append("self.process_deferred_asserts()")
4143
4178
elif action[0] == "c_l_s":
4144
4179
sb_actions.append("self.clear_local_storage()")
4145
4180
elif action[0] == "c_s_s":
@@ -9574,14 +9609,26 @@ def wait_for_element(self, selector, by="css selector", timeout=None):
9574
9609
timeout = settings.LARGE_TIMEOUT
9575
9610
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
9576
9611
timeout = self.__get_new_timeout(timeout)
9612
+ original_selector = selector
9577
9613
selector, by = self.__recalculate_selector(selector, by)
9614
+ if self.recorder_mode:
9615
+ url = self.get_current_url()
9616
+ if url and len(url) > 0:
9617
+ if ("http:") in url or ("https:") in url or ("file:") in url:
9618
+ if self.get_session_storage_item("pause_recorder") == "no":
9619
+ if by == By.XPATH:
9620
+ selector = original_selector
9621
+ time_stamp = self.execute_script("return Date.now();")
9622
+ origin = self.get_origin()
9623
+ action = ["wf_el", selector, origin, time_stamp]
9624
+ self.__extra_actions.append(action)
9578
9625
if self.__is_shadow_selector(selector):
9579
9626
return self.__wait_for_shadow_element_visible(selector, timeout)
9580
9627
return page_actions.wait_for_element_visible(
9581
9628
self.driver, selector, by, timeout
9582
9629
)
9583
9630
9584
- def get_element(self, selector, by=By.CSS_SELECTOR , timeout=None):
9631
+ def get_element(self, selector, by="css selector" , timeout=None):
9585
9632
"""Same as wait_for_element_present() - returns the element.
9586
9633
The element does not need be visible (it may be hidden)."""
9587
9634
self.__check_scope()
@@ -10919,6 +10966,15 @@ def deferred_assert_element(
10919
10966
self.__last_url_of_deferred_assert = url
10920
10967
except Exception:
10921
10968
pass
10969
+ if self.recorder_mode:
10970
+ url = self.get_current_url()
10971
+ if url and len(url) > 0:
10972
+ if ("http:") in url or ("https:") in url or ("file:") in url:
10973
+ if self.get_session_storage_item("pause_recorder") == "no":
10974
+ time_stamp = self.execute_script("return Date.now();")
10975
+ origin = self.get_origin()
10976
+ action = ["da_el", selector, origin, time_stamp]
10977
+ self.__extra_actions.append(action)
10922
10978
try:
10923
10979
self.wait_for_element_visible(selector, by=by, timeout=timeout)
10924
10980
return True
@@ -10992,6 +11048,16 @@ def deferred_assert_text(
10992
11048
self.__last_url_of_deferred_assert = url
10993
11049
except Exception:
10994
11050
pass
11051
+ if self.recorder_mode:
11052
+ url = self.get_current_url()
11053
+ if url and len(url) > 0:
11054
+ if ("http:") in url or ("https:") in url or ("file:") in url:
11055
+ if self.get_session_storage_item("pause_recorder") == "no":
11056
+ time_stamp = self.execute_script("return Date.now();")
11057
+ origin = self.get_origin()
11058
+ text_selector = [text, selector]
11059
+ action = ["da_te", text_selector, origin, time_stamp]
11060
+ self.__extra_actions.append(action)
10995
11061
try:
10996
11062
self.wait_for_text_visible(text, selector, by=by, timeout=timeout)
10997
11063
return True
@@ -11024,6 +11090,16 @@ def deferred_assert_exact_text(
11024
11090
self.__last_url_of_deferred_assert = url
11025
11091
except Exception:
11026
11092
pass
11093
+ if self.recorder_mode:
11094
+ url = self.get_current_url()
11095
+ if url and len(url) > 0:
11096
+ if ("http:") in url or ("https:") in url or ("file:") in url:
11097
+ if self.get_session_storage_item("pause_recorder") == "no":
11098
+ time_stamp = self.execute_script("return Date.now();")
11099
+ origin = self.get_origin()
11100
+ text_selector = [text, selector]
11101
+ action = ["da_et", text_selector, origin, time_stamp]
11102
+ self.__extra_actions.append(action)
11027
11103
try:
11028
11104
self.wait_for_exact_text_visible(
11029
11105
text, selector, by=by, timeout=timeout
@@ -11076,6 +11152,11 @@ def process_deferred_asserts(self, print_only=False):
11076
11152
the deferred asserts on a single html page so that the failure
11077
11153
screenshot matches the location of the deferred asserts.
11078
11154
If "print_only" is set to True, the exception won't get raised."""
11155
+ if self.recorder_mode:
11156
+ time_stamp = self.execute_script("return Date.now();")
11157
+ origin = self.get_origin()
11158
+ action = ["pr_da", "", origin, time_stamp]
11159
+ self.__extra_actions.append(action)
11079
11160
if self.__deferred_assert_failures:
11080
11161
exception_output = ""
11081
11162
exception_output += "\n***** DEFERRED ASSERTION FAILURES:\n"
0 commit comments