@@ -3350,9 +3350,11 @@ def __process_recorded_actions(self):
3350
3350
ext_actions .append ("hi_li" )
3351
3351
ext_actions .append ("as_lt" )
3352
3352
ext_actions .append ("as_ti" )
3353
+ ext_actions .append ("as_df" )
3354
+ ext_actions .append ("do_fi" )
3355
+ ext_actions .append ("as_at" )
3353
3356
ext_actions .append ("as_te" )
3354
3357
ext_actions .append ("as_et" )
3355
- ext_actions .append ("as_at" )
3356
3358
ext_actions .append ("sw_fr" )
3357
3359
ext_actions .append ("sw_dc" )
3358
3360
ext_actions .append ("s_c_f" )
@@ -3539,6 +3541,22 @@ def __process_recorded_actions(self):
3539
3541
sb_actions .append ('self.%s("%s")' % (method , action [1 ]))
3540
3542
else :
3541
3543
sb_actions .append ("self.%s('%s')" % (method , action [1 ]))
3544
+ elif action [0 ] == "as_df" :
3545
+ method = "assert_downloaded_file"
3546
+ if '"' not in action [1 ]:
3547
+ sb_actions .append ('self.%s("%s")' % (method , action [1 ]))
3548
+ else :
3549
+ sb_actions .append ("self.%s('%s')" % (method , action [1 ]))
3550
+ elif action [0 ] == "do_fi" :
3551
+ method = "download_file"
3552
+ file_url = action [1 ][0 ]
3553
+ dest = action [1 ][1 ]
3554
+ if not dest :
3555
+ sb_actions .append ('self.%s("%s")' % (
3556
+ method , file_url ))
3557
+ else :
3558
+ sb_actions .append ('self.%s("%s", "%s")' % (
3559
+ method , file_url , dest ))
3542
3560
elif action [0 ] == "as_at" :
3543
3561
method = "assert_attribute"
3544
3562
if ('"' not in action [1 ][0 ]) and action [1 ][2 ]:
@@ -4608,6 +4626,16 @@ def download_file(self, file_url, destination_folder=None):
4608
4626
if not os .path .exists (destination_folder ):
4609
4627
os .makedirs (destination_folder )
4610
4628
page_utils ._download_file_to (file_url , destination_folder )
4629
+ if self .recorder_mode :
4630
+ url = self .get_current_url ()
4631
+ if url and len (url ) > 0 :
4632
+ if ("http:" ) in url or ("https:" ) in url or ("file:" ) in url :
4633
+ if self .get_session_storage_item ("pause_recorder" ) == "no" :
4634
+ time_stamp = self .execute_script ("return Date.now();" )
4635
+ origin = self .get_origin ()
4636
+ url_dest = [file_url , destination_folder ]
4637
+ action = ["do_fi" , url_dest , origin , time_stamp ]
4638
+ self .__extra_actions .append (action )
4611
4639
4612
4640
def save_file_as (self , file_url , new_file_name , destination_folder = None ):
4613
4641
"""Similar to self.download_file(), except that you get to rename the
@@ -4776,6 +4804,15 @@ def assert_downloaded_file(self, file, timeout=None, browser=False):
4776
4804
% (file , self .get_downloads_folder (), timeout )
4777
4805
)
4778
4806
page_actions .timeout_exception ("NoSuchFileException" , message )
4807
+ if self .recorder_mode :
4808
+ url = self .get_current_url ()
4809
+ if url and len (url ) > 0 :
4810
+ if ("http:" ) in url or ("https:" ) in url or ("file:" ) in url :
4811
+ if self .get_session_storage_item ("pause_recorder" ) == "no" :
4812
+ time_stamp = self .execute_script ("return Date.now();" )
4813
+ origin = self .get_origin ()
4814
+ action = ["as_df" , file , origin , time_stamp ]
4815
+ self .__extra_actions .append (action )
4779
4816
if self .demo_mode :
4780
4817
messenger_post = "ASSERT DOWNLOADED FILE: [%s]" % file
4781
4818
try :
0 commit comments