Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation warnings emitted when using firefox. #43

Merged
merged 2 commits into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Changelog
7.1 (unreleased)
----------------

- Nothing changed yet.
- Fix deprecation warnings emitted when using ``firefox``.


7.0 (2022-06-28)
Expand Down
24 changes: 11 additions & 13 deletions src/gocept/selenium/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

from selenium.common.exceptions import JavascriptException
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
import atexit
import gocept.selenium.wd_selenese
import os
Expand Down Expand Up @@ -89,24 +88,23 @@ def get_firefox_webdriver_args(self):
if self['headless']:
options.add_argument('-headless')

profile = FirefoxProfile(
icemac marked this conversation as resolved.
Show resolved Hide resolved
os.environ.get(
'GOCEPT_WEBDRIVER_FF_PROFILE',
os.environ.get('GOCEPT_SELENIUM_FF_PROFILE')))
profile.native_events_enabled = True
profile.update_preferences()
icemac marked this conversation as resolved.
Show resolved Hide resolved
profile_path = os.environ.get(
'GOCEPT_WEBDRIVER_FF_PROFILE',
os.environ.get('GOCEPT_SELENIUM_FF_PROFILE'))
if profile_path:
options.set_preference('profile', profile_path)

# Save downloads always to disk into a predefined dir.
profile.set_preference("browser.download.folderList", 2)
profile.set_preference(
options.set_preference("browser.download.folderList", 2)
options.set_preference(
"browser.download.manager.showWhenStarting", False)
profile.set_preference(
options.set_preference(
"browser.download.dir", str(self['selenium_download_dir']))
profile.set_preference(
options.set_preference(
"browser.helperApps.neverAsk.saveToDisk", "application/pdf")
profile.set_preference("pdfjs.disabled", True)
options.set_preference("pdfjs.disabled", True)

return {'options': options, 'firefox_profile': profile}
return {'options': options}

def get_edge_webdriver_args(self):
options = selenium.webdriver.edge.options.Options()
Expand Down