5

I need to disable 'show all' download bar of chrome in selenium.

Because the download bar is showing, UI elements in the lower portion of my page that need to be clicked are not visible. I'm looking for something like the way we disable notification bars with

ChromeOptions options = new ChromeOptions(); 
options.addArguments("disable-infobars"); 

Is there a way to disable the download bar like this, and where can I find the information?

9
  • Hey @sreelakshmi, you might want to expand on this question before it gets closed off. Can you provide more information?
    – dvniel
    Mar 13, 2017 at 10:37
  • I want to know how to disable 'download' bar in chrome browser throrugh code.. like we disable notification bars like ChromeOptions options = new ChromeOptions(); options.addArguments("disable-infobars"); is there anyway to disable download bar like this Mar 13, 2017 at 11:05
  • Have you tried installing the add-on for Chrome? chrome.google.com/webstore/detail/disable-download-bar/…
    – dvniel
    Mar 13, 2017 at 11:16
  • Yes.. but when automation is running those add-ons are not in active.... automation starts running in new window. Mar 13, 2017 at 11:54
  • any updates regarding this issue... Mar 16, 2017 at 9:58

3 Answers 3

0

Best Approach would be to Use Actions class in this case. The Element you need to interact with after the download bar is visible will be accessible with Actions class methods such as moveToElement().

This will save you the hassle of switching tabs and is a more neat approach.

2
  • 1
    Please add demonstrable code to this answer.
    – Brian
    Sep 10, 2019 at 17:03
  • 1
    To add a demonstrable code , I will need the HTML of the element with which we are interacting and is hidden below the download bar. You can refer to selenium action class docs for details. Sep 11, 2019 at 5:17
0

One way to solve this would be to set up a custom chrome profile in which you disable the download prompt, save it to a specific location inside your project, then use to pass as an argument to ChromeOptions.

var options = new ChromeOptions();
options.AddArgument("--profile-directory=AutoUser");
    or
options.AddArgument("--user-data-dir=C:/Users/YourUserName/AppData/Local/Google/Chrome/User Data");
0

Yes, there is a way to disable the download bar in Chrome using Selenium. You can use the ChromeOptions class to add the argument "disable-features=DownloadUI" to the ChromeOptions object, which will disable the download bar. Here's an example:

ChromeOptions options = new ChromeOptions();
options.addArguments("disable-features=DownloadUI");
WebDriver driver = new ChromeDriver(options);

This will launch Chrome with the download bar disabled.

You can find more information about ChromeOptions and the available arguments in the official Selenium documentation:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.