@@ -7678,10 +7678,13 @@ def assert_downloaded_file(self, file, timeout=None, browser=False):
7678
7678
break
7679
7679
time.sleep(1)
7680
7680
if not found and not os.path.exists(downloaded_file_path):
7681
+ plural = "s"
7682
+ if timeout == 1:
7683
+ plural = ""
7681
7684
message = (
7682
7685
"File {%s} was not found in the downloads folder {%s} "
7683
- "after %s seconds ! (Or the download didn't complete!)"
7684
- % (file, df, timeout)
7686
+ "after %s second%s ! (Or the download didn't complete!)"
7687
+ % (file, df, timeout, plural )
7685
7688
)
7686
7689
page_actions.timeout_exception("NoSuchFileException", message)
7687
7690
if self.recorder_mode and self.__current_url_is_recordable():
@@ -7735,10 +7738,13 @@ def assert_downloaded_file_regex(self, regex, timeout=None, browser=False):
7735
7738
break
7736
7739
time.sleep(1)
7737
7740
if not found:
7741
+ plural = "s"
7742
+ if timeout == 1:
7743
+ plural = ""
7738
7744
message = (
7739
7745
"Regex {%s} was not found in the downloads folder {%s} "
7740
- "after %s seconds ! (Or the download didn't complete!)"
7741
- % (regex, df, timeout)
7746
+ "after %s second%s ! (Or the download didn't complete!)"
7747
+ % (regex, df, timeout, plural )
7742
7748
)
7743
7749
page_actions.timeout_exception("NoSuchFileException", message)
7744
7750
if self.demo_mode:
@@ -10177,9 +10183,13 @@ def wait_for_link_text_present(self, link_text, timeout=None):
10177
10183
if now_ms >= stop_ms:
10178
10184
break
10179
10185
time.sleep(0.2)
10180
- message = "Link text {%s} was not found after %s seconds!" % (
10186
+ plural = "s"
10187
+ if timeout == 1:
10188
+ plural = ""
10189
+ message = "Link text {%s} was not found after %s second%s!" % (
10181
10190
link_text,
10182
10191
timeout,
10192
+ plural,
10183
10193
)
10184
10194
page_actions.timeout_exception("LinkTextNotFoundException", message)
10185
10195
@@ -10202,9 +10212,12 @@ def wait_for_partial_link_text_present(self, link_text, timeout=None):
10202
10212
if now_ms >= stop_ms:
10203
10213
break
10204
10214
time.sleep(0.2)
10215
+ plural = "s"
10216
+ if timeout == 1:
10217
+ plural = ""
10205
10218
message = (
10206
- "Partial Link text {%s} was not found after %s seconds !"
10207
- "" % (link_text, timeout)
10219
+ "Partial Link text {%s} was not found after %s second%s !"
10220
+ "" % (link_text, timeout, plural )
10208
10221
)
10209
10222
page_actions.timeout_exception("LinkTextNotFoundException", message)
10210
10223
@@ -14412,9 +14425,12 @@ def __get_shadow_element(
14412
14425
if must_be_visible and is_present:
14413
14426
error = "not visible"
14414
14427
the_exception = "ElementNotVisibleException"
14428
+ plural = "s"
14429
+ if timeout == 1:
14430
+ plural = ""
14415
14431
msg = (
14416
- "Shadow DOM Element {%s} was %s after %s seconds !"
14417
- % (selector_chain, error, timeout)
14432
+ "Shadow DOM Element {%s} was %s after %s second%s !"
14433
+ % (selector_chain, error, timeout, plural )
14418
14434
)
14419
14435
page_actions.timeout_exception(the_exception, msg)
14420
14436
return element
0 commit comments