0

how to set chrome download path in protractor?

Is this possible? im about to write e2e tests wherein i need to download a file and set a specific path for it.

here's protractor.conf

capabilities: {
    browserName: "chrome",
    chromeOptions: {
        args: ["--disable-gpu"],
        prefs: {
            "download": {
                "prompt_for_download": false,
                "directory_upgrade": true,
                "default_directory": "C:\jobs\\"
            }
        }
    }
}

The default_folder seems not to be working on my end.

Suggestions and tips are greatly appreciated!

Thank you!

nhoyti
  • 1,615
  • 2
  • 26
  • 42
  • It seems like [this answer](https://stackoverflow.com/questions/27824124/how-to-change-file-download-location-in-webdriver-while-using-chrome-driver-fire) shows how to change the download path in Selenium using the Java API. Is that what you're looking for? – jbinvnt Jul 05 '19 at 00:03
  • hello! i'am using typescript for it – nhoyti Jul 05 '19 at 00:41

1 Answers1

1

I have already found the fix for it. Here's the updated code

capabilities: {
    browserName: "chrome",
    chromeOptions: {
        args: ["--disable-gpu"],
        prefs: {
            download: {
                prompt_for_download: false,
                directory_upgrade: true,
                default_directory: `${__dirname}\\src\\json.file\\`
            }
        }
    }
}
nhoyti
  • 1,615
  • 2
  • 26
  • 42