Skip to content

Commit 51df1d7

Browse files
committed
Add removed method by mistake
1 parent 5f23fc6 commit 51df1d7

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

modules/browser_object_navigation.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,35 @@ def click_file_download_warning_panel(self) -> BasePage:
291291
self.click_on("file-download-warning-button")
292292
return self
293293

294-
@BasePage.context_chrome
295-
def wait_for_download_elements(self) -> BasePage:
294+
# @BasePage.context_chrome
295+
# def wait_for_download_elements(self) -> BasePage:
296+
# """
297+
# Wait for download elements to be present.
298+
# """
299+
# self.element_visible("download-target-element")
300+
# return self
301+
302+
def wait_for_item_to_download(self, filename: str) -> BasePage:
296303
"""
297-
Wait for download elements to be present.
304+
Check the downloads tool in the toolbar to wait for a given file to download
298305
"""
299-
self.element_visible("download-target-element")
306+
original_timeout = self.driver.timeouts.implicit_wait
307+
try:
308+
# Whatever our timeout, we want to lengthen it because downloads
309+
self.driver.implicitly_wait(original_timeout * 2)
310+
self.element_visible("downloads-item-by-file", labels=[filename])
311+
self.expect_not(
312+
EC.element_attribute_to_include(
313+
self.get_selector("downloads-button"), "animate"
314+
)
315+
)
316+
with self.driver.context(self.context_id):
317+
self.driver.execute_script(
318+
"arguments[0].setAttribute('hidden', true)",
319+
self.get_element("downloads-button"),
320+
)
321+
finally:
322+
self.driver.implicitly_wait(original_timeout)
300323
return self
301324

302325
@BasePage.context_chrome

tests/downloads/test_mixed_content_download_via_https.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ def test_mixed_content_download_via_https(driver: Firefox, delete_files):
3333
web_page.open()
3434
web_page.wait.until(lambda _: web_page.title_contains("File Examples"))
3535

36-
# Wait for download elements to appear
37-
nav.wait_for_download_elements()
38-
3936
# Verify download name matches expected pattern
4037
nav.verify_download_name(r"file-sample_100kB(\(\d+\))?.odt$")
4138

0 commit comments

Comments
 (0)