Skip to content

Commit f6ed828

Browse files
committed
Improve self.assert_downloaded_file(file)
1 parent 9b41990 commit f6ed828

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3152,24 +3152,22 @@ def assert_downloaded_file(self, file, timeout=None, browser=False):
31523152
start_ms = time.time() * 1000.0
31533153
stop_ms = start_ms + (timeout * 1000.0)
31543154
downloaded_file_path = self.get_path_of_downloaded_file(file, browser)
3155+
found = False
31553156
for x in range(int(timeout)):
31563157
shared_utils.check_if_time_limit_exceeded()
31573158
try:
31583159
self.assertTrue(
31593160
os.path.exists(downloaded_file_path),
31603161
"File [%s] was not found in the downloads folder [%s]!"
31613162
"" % (file, self.get_downloads_folder()))
3162-
if self.demo_mode:
3163-
messenger_post = ("ASSERT DOWNLOADED FILE: [%s]" % file)
3164-
js_utils.post_messenger_success_message(
3165-
self.driver, messenger_post, self.message_duration)
3166-
return
3163+
found = True
3164+
break
31673165
except Exception:
31683166
now_ms = time.time() * 1000.0
31693167
if now_ms >= stop_ms:
31703168
break
31713169
time.sleep(1)
3172-
if not os.path.exists(downloaded_file_path):
3170+
if not found and not os.path.exists(downloaded_file_path):
31733171
message = (
31743172
"File {%s} was not found in the downloads folder {%s} "
31753173
"after %s seconds! (Or the download didn't complete!)"

0 commit comments

Comments
 (0)