* 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)
| 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. |
no test coverage detected