I don’t even know if the name of that is “window”: it’s not in the DOM, but in the browser, and Firefox opens it everytime a download is completed. I can be accessed with Ctrl+Shift+y
if I do it manually.
I’m downloading some pdfs with python and selenium. I set all options for downloading those files without any additional window, and to my belief, to avoid “the window” (which I thought was the “download panel”):
profile.set_preference("browser.download.folderList", 2)
profile.set_preference("browser.download.dir", download_dir)
profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/pdf")
profile.set_preference("pdfjs.disabled", True) # Disable built-in PDF viewer
# Suppress download panel notifications
profile.set_preference("browser.download.panel.shown", False)
profile.set_preference("browser.download.panel.suppress", True)
That didn’t help, so I tried to, after each iteration, change context and send Ctrl+Shift+y
:
driver.set_context("chrome")
# Create a var of the window and send the key combo
win = driver.find_element(By.TAG_NAME,"html")
win.send_keys(Keys.CONTROL + Keys.SHIFT + 'y')
# Set the focus back to content
driver.set_context("content")
That didn’t work either, it sent the keys flawlessly, but the intruding window remained there.
It wouldn’t be much of a problem if the window were only in the desktop where I’m running the script, but it shows in all desktops (here in the one running the script, and in an empty desktop. At this moment I’m using only half the screen to write this!)
I’m running:
- Ubuntu 22.04 (both gnome/wayland and i3 display the problem)
- Mozilla Firefox 128.0.3
- Python 3.10.12
- selenium Version: 4.23.1