seleniumbase / SeleniumBase

📊 Python's all-in-one framework for web crawling, scraping, testing, and reporting. Supports pytest. UC Mode provides stealth. Includes many tools.
https://seleniumbase.io
MIT License
4.46k stars 910 forks source link

Disable download directory prompt when using selenium base #2894

Closed kiljag closed 5 days ago

kiljag commented 6 days ago

Hi, I am trying to automate a download process using seleniumbase. I am able to automate all the steps till clicking the download button, but the chrome instance that got spawned is asking for download directory confirmation. I am on a mac and using latest chrome version and doing this non-headless mode. Is there a way to disable this prompt?

Here are the SB parameters. with SB(uc=True, slow=True, incognito=True, headed=True) as sb:

Although, I can disable this in selenium by setting download.prompt_for_download=False in chrome options. Is there a way to do similar thing in selenium base. Thank you.

mdmintz commented 5 days ago

It was already being set: https://github.com/seleniumbase/SeleniumBase/blob/1c526f1c02a9c7f4ec538d1600829acff44aa05e/seleniumbase/core/browser_launcher.py#L1037

And I also tried the DownloadBubble switches: https://github.com/seleniumbase/SeleniumBase/blob/1c526f1c02a9c7f4ec538d1600829acff44aa05e/seleniumbase/core/browser_launcher.py#L1373-L1374

The real issue is due to an external Chromium bug with incognito mode: https://issues.chromium.org/issues/42323647

Lots of regular Chromium users have encountered it:

The easiest way to bypass this issue is to avoid using incognito mode when you need to download files via clicking on links.