I built a Selenium test script to download multiple files through Firefox. The web-page pops a modal window for the download. I detect a file is downloaded by checking the download folder and continue on to the next file. A moment later after the first file downloads, Firefox shows an alert hanging off of the download button. It only does this once. While that alert shows, the Selenium driver cannot find certain react elements on the modal window. I’ve tried various Firefox preference settings suggested by various bloggers and the alert still shows hanging off of the download toolbar button.
The script runs fine when I manually remove the download button from the Firefox toolbar. Removing the download toolbar button shows that the alerts off of the download button are getting in the way. But this manual intervention is not a workable solution unless I can automate the removal of the download button from the toolbar. Do you see something I should fix in the code below or otherwise try from my description above?
# Python version = 3.12.3
# Selenium version = 4.22.0
# Firefox version = 128.0
options = FFOptions()
options.set_preference("browser.download.panel.shown", False)
options.set_preference("browser.download.alwaysOpenPanel", False)
options.set_preference("browser.download.manager.showWhenStarting", False)
options.set_preference("browser.download.manager.focusWhenStarting", False)
options.set_preference("browser.download.manager.showAlertOnComplete", False)
options.set_preference("browser.download.manager.useWindow", False)
service = FFService(executable_path="/snap/bin/geckodriver")
self.driver = webdriver.Firefox(options=options, service=service)