File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -1022,6 +1022,17 @@ def wait_for_downloads(self, timeout: int = 120000):
10221022 Args:
10231023 timeout (int, optional): Timeout in millis. Defaults to 120000.
10241024 """
1025+ if self .browser in [Browser .CHROME , Browser .EDGE ] and self .headless :
1026+ start_time = time .time ()
1027+ while True :
1028+ elapsed_time = (time .time () - start_time ) * 1000
1029+ if elapsed_time > timeout :
1030+ return False
1031+ downloads_count = self .get_file_count (self .download_folder_path , ".crdownload" )
1032+ if downloads_count == 0 :
1033+ return True
1034+ self .sleep (config .DEFAULT_SLEEP_AFTER_ACTION )
1035+
10251036 wait_method = BROWSER_CONFIGS .get (self .browser ).get ("wait_for_downloads" )
10261037 # waits for all the files to be completed
10271038 WebDriverWait (self ._driver , timeout / 1000 , 1 ).until (wait_method )
You can’t perform that action at this time.
0 commit comments