Skip to content

Commit

Permalink
#20 add download directory
Browse files Browse the repository at this point in the history
  • Loading branch information
vernans committed Jan 13, 2021
1 parent 831c975 commit 6d72931
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/gocept/selenium/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@ def get_chrome_webdriver_args(self):
raise NotImplementedError(
'Chromedriver currently only works headless.')

# Setup download dir.
self['selenium_download_dir'] = pathlib.Path(tempfile.mkdtemp(
prefix='gocept.selenium.download-dir'))

prefs = {
'download.default_directory': str(self['selenium_download_dir']),
'download.prompt_for_download': False,
}

options.add_experimental_option('prefs', prefs)

return {
'options': options,
'service_args': ['--log-path=chromedriver.log']
Expand Down

0 comments on commit 6d72931

Please sign in to comment.