MCPcopy
hub / github.com/SeleniumHQ/selenium / setDownloadPath

Method setDownloadPath

javascript/selenium-webdriver/chromium.js:771–783  ·  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

769 * @see #sendDevToolsCommand
770 */
771 async setDownloadPath(path) {
772 if (!path || typeof path !== 'string') {
773 throw new error.InvalidArgumentError('invalid download path')
774 }
775 const stat = await io.stat(path)
776 if (!stat.isDirectory()) {
777 throw new error.InvalidArgumentError('not a directory: ' + path)
778 }
779 return this.sendDevToolsCommand('Page.setDownloadBehavior', {
780 behavior: 'allow',
781 downloadPath: path,
782 })
783 }
784
785 /**
786 * 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