TestProject Forum

Selenium desired capabilities to allow xml file download in Chrome

Hello

I am trying to re-create an upload test on browserstack and need first to download an xml file to have it available for the current test session. This file type download attempt triggers the message “This type of file can harm your computer” which defers the download until the user clicks on “Keep” - which of course can’t be handled during the remote test execution.

I’ve tried using the following capabilities in the job section, but they don’t work - I keep getting the same notification in the browser.

{
  "goog:chromeOptions": {
    "args": [
      "start-maximized",
      "--disable-infobars",
      "--disable-notifications",
      "--safebrowsing-disable-download-protection",
      "safebrowsing-disable-extension-blacklist"
    ]
  }
}

Does anyone have any idea what else might help to download an xml without prompting that notification?

1 Like

Hi @SN85,
Please try to use these capabilities, this will download your xml file without the harm file popup

{
 "goog:chromeOptions": {
   "args": [
     "--disable-breakpad"
   ],
   "prefs": {
     "download.prompt_for_download": "false",
     "profile.default_content_settings.popups": 0,
     "safebrowsing.enabled": "false"
   }
 }
}

Please let me know if that works for you.

1 Like

Hi @Tal.Efraim “safebrowsing.enabled”: “false” in prefs did the trick. Thank you!

Do you have a good resource where to deduct which args and prefs could be used in desired capabilities? If one checks Capabilities specific to Chromium browsers | Selenium it is unfortunately rather unhelpful and maybe you have some better hints with your experience.

@Tal.Efraim
Can we pass additional Request Headers via Selenium Desired Capabilities?
Our test website needs this in the HTTP header so that we can point to Staging Endpoint.