How to disable download window prompt when a download button is clicked #2454
Answered
by
mdmintz
Weberworld
asked this question in
Q&A
-
How to disable a download window prompt after using the execute_script method to click on a download button element. using the below seleniumbase driver usage style
|
Beta Was this translation helpful? Give feedback.
Answered by
mdmintz
Jan 27, 2024
Replies: 1 comment
-
There are no prompts that you need to interact with when downloading files. Example: from seleniumbase import Driver
driver = Driver(uc=True)
try:
driver.get("https://pypi.org/project/seleniumbase/#files")
driver.assert_element("span#pip-command")
driver.assert_text("Download files", "div#files h2.page-title")
driver.assert_text("Download files", "a#files-tab")
pkg_header = driver.get_text("h1.package-header__name").strip()
pkg_name = pkg_header.replace(" ", "-")
whl_file = pkg_name + "-py3-none-any.whl"
tar_gz_file = pkg_name + ".tar.gz"
whl_selector = 'div#files a[href$="%s"]' % whl_file
# Click the link to download the file into: "./downloaded_files/"
driver.click(whl_selector) # Download the "whl" file
driver.sleep(7)
finally:
driver.quit() |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
mdmintz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are no prompts that you need to interact with when downloading files. Example: