MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / setDownloadPath

Method setDownloadPath

javascript/selenium-webdriver/chromium.js:772–784  ·  view source on GitHub ↗

* Sends a DevTools command to change the browser's download directory. * * @param {string} path The desired download directory. * @return {!Promise } A promise that will be resolved when the command * has finished. * @see #sendDevToolsCommand

(path)

Source from the content-addressed store, hash-verified

770 * @see #sendDevToolsCommand
771 */
772 async setDownloadPath(path) {
773 if (!path || typeof path !== 'string') {
774 throw new error.InvalidArgumentError('invalid download path')
775 }
776 const stat = await io.stat(path)
777 if (!stat.isDirectory()) {
778 throw new error.InvalidArgumentError('not a directory: ' + path)
779 }
780 return this.sendDevToolsCommand('Page.setDownloadBehavior', {
781 behavior: 'allow',
782 downloadPath: path,
783 })
784 }
785
786 /**
787 * Returns the list of cast sinks (Cast devices) available to the Chrome media router.

Callers 1

devtools_test.jsFile · 0.80

Calls 2

sendDevToolsCommandMethod · 0.95
isDirectoryMethod · 0.65

Tested by

no test coverage detected