Skip to content

Commit abc558c

Browse files
committed
Update exception message output
1 parent ca5fc0a commit abc558c

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2519,11 +2519,12 @@ def assert_downloaded_file(self, file, timeout=None):
25192519
if now_ms >= stop_ms:
25202520
break
25212521
time.sleep(1)
2522-
self.assertTrue(
2523-
os.path.exists(self.get_path_of_downloaded_file(file)),
2524-
"File [%s] was not found in the downloads folder [%s] "
2525-
"after %s seconds! (Or the download didn't complete!)"
2526-
"" % (file, self.get_downloads_folder(), timeout))
2522+
if not os.path.exists(self.get_path_of_downloaded_file(file)):
2523+
message = (
2524+
"File {%s} was not found in the downloads folder {%s} "
2525+
"after %s seconds! (Or the download didn't complete!)"
2526+
"" % (file, self.get_downloads_folder(), timeout))
2527+
page_actions.timeout_exception("NoSuchFileException", message)
25272528
if self.demo_mode:
25282529
messenger_post = ("ASSERT DOWNLOADED FILE: [%s]" % file)
25292530
js_utils.post_messenger_success_message(
@@ -3769,9 +3770,10 @@ def wait_for_link_text_present(self, link_text, timeout=None):
37693770
if now_ms >= stop_ms:
37703771
break
37713772
time.sleep(0.2)
3772-
raise Exception(
3773-
"Link text {%s} was not present after %s seconds!" % (
3774-
link_text, timeout))
3773+
message = (
3774+
"Link text {%s} was not present after %s seconds!"
3775+
"" % (link_text, timeout))
3776+
page_actions.timeout_exception("NoSuchElementException", message)
37753777

37763778
def wait_for_partial_link_text_present(self, link_text, timeout=None):
37773779
if not timeout:
@@ -3790,9 +3792,10 @@ def wait_for_partial_link_text_present(self, link_text, timeout=None):
37903792
if now_ms >= stop_ms:
37913793
break
37923794
time.sleep(0.2)
3793-
raise Exception(
3794-
"Partial Link text {%s} was not present after %s seconds!" % (
3795-
link_text, timeout))
3795+
message = (
3796+
"Partial Link text {%s} was not present after %s seconds!"
3797+
"" % (link_text, timeout))
3798+
page_actions.timeout_exception("NoSuchElementException", message)
37963799

37973800
def wait_for_link_text_visible(self, link_text, timeout=None):
37983801
if not timeout:

0 commit comments

Comments
 (0)