mozilla / geckodriver

WebDriver for Firefox
https://firefox-source-docs.mozilla.org/testing/geckodriver/
Mozilla Public License 2.0
7.13k stars 1.52k forks source link

selenium.common.exceptions.InvalidArgumentException: Message: Invalid moz:firefoxOptions field env #1821

Open wuwang-wang opened 3 years ago

wuwang-wang commented 3 years ago

System

Testcase

capabilities = webdriver.DesiredCapabilities.FIREFOX.copy() if 'ignoreSSL' in job and job['ignoreSSL']: capabilities['acceptInsecureCerts'] = True else: capabilities['acceptInsecureCerts'] = False capabilities['moz:firefoxOptions'] = { 'binary': self.path, 'args': ['-profile', task['profile']], 'prefs': self.prepare_prefs(), 'log': {'level': 'error'}, 'env': { 'MOZ_LOG_FILE': os.environ['MOZ_LOG_FILE'], 'MOZ_LOG': os.environ['MOZ_LOG']} } service_args = ["--marionette-port", "2828"] self.driver = webdriver.Firefox(desired_capabilities=capabilities, service_args=service_args) https://github.com/WPO-Foundation/wptagent/pull/389/commits/c1b5747770f69c621127ac5306b1fd3c18c9fddc ## Stacktrace

Traceback (most recent call last): File "/Users/wuyangwang/wptagent_git/wuwang_wptagent/wptagent-1/internal/firefox.py", line 179, in launch self.start_firefox(job, task) File "/Users/wuyangwang/wptagent_git/wuwang_wptagent/wptagent-1/internal/firefox_webdriver.py", line 54, in start_firefox self.driver = webdriver.Firefox(desired_capabilities=capabilities, service_args=service_args) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/firefox/webdriver.py", line 170, in init RemoteWebDriver.init( File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in init self.start_session(capabilities, browser_profile) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.InvalidArgumentException: Message: Invalid moz:firefoxOptions field env

Trace-level log

my local geckodriver.log is empty

whimboo commented 3 years ago

Right now this only works for Android specific connections. The documentation might have to be updated.

If you run it locally just pass the env through Selenium so these are getting passed to geckodriver. Then geckodriver will automatically forward it to Firefox.