Prefs change for the ChromeOptions not working #7347
yzvezdin
started this conversation in
Technical Discussion
Replies: 1 comment 14 replies
-
@yzvezdin the following worked for me: const { remote } = require('webdriverio')
let browser
const opts = {
// automationProtocol: 'devtools',
capabilities: {
browserName: 'chrome',
'goog:chromeOptions': {
prefs: {
'download.default_directory': __dirname
}
}
}
}
;(async function () {
browser = await remote(opts)
await browser.url('https://the-internet.herokuapp.com/download')
const link = await browser.$("a[href*='some-file.txt']")
await link.click()
await browser.pause(5000)
await browser.deleteSession()
})().catch(async (e) => {
console.error(e.stack)
await browser.deleteSession()
}) Note: this of course only works for local test. If you run tests in a remote location (e.g. Selenium Grid or a vendor like Sauce Labs) this obviously won't work. |
Beta Was this translation helpful? Give feedback.
14 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys,
We need to change the download path and set it via prefs as all the documentation says. However these values are not implemented in Chrome. Default path to Downloads is set and not changed
Beta Was this translation helpful? Give feedback.
All reactions