@@ -2519,11 +2519,12 @@ def assert_downloaded_file(self, file, timeout=None):
2519
2519
if now_ms >= stop_ms :
2520
2520
break
2521
2521
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 )
2527
2528
if self .demo_mode :
2528
2529
messenger_post = ("ASSERT DOWNLOADED FILE: [%s]" % file )
2529
2530
js_utils .post_messenger_success_message (
@@ -3769,9 +3770,10 @@ def wait_for_link_text_present(self, link_text, timeout=None):
3769
3770
if now_ms >= stop_ms :
3770
3771
break
3771
3772
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 )
3775
3777
3776
3778
def wait_for_partial_link_text_present (self , link_text , timeout = None ):
3777
3779
if not timeout :
@@ -3790,9 +3792,10 @@ def wait_for_partial_link_text_present(self, link_text, timeout=None):
3790
3792
if now_ms >= stop_ms :
3791
3793
break
3792
3794
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 )
3796
3799
3797
3800
def wait_for_link_text_visible (self , link_text , timeout = None ):
3798
3801
if not timeout :
0 commit comments