mozilla / geckodriver

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

selenium scroll_by_amount on Linux error #2103

Closed hoba87 closed 1 year ago

hoba87 commented 1 year ago

System

Testcase

Look also here: https://github.com/SeleniumHQ/selenium/issues/11891

import os
from selenium import webdriver
from selenium.webdriver.firefox.options import Options as FirefoxOptions
from selenium.webdriver.firefox.service import Service as FirefoxService
from selenium.webdriver import ActionChains

options = FirefoxOptions()
options.add_argument('-headless')
options.log.level = "trace"
service = FirefoxService()
browser = webdriver.Firefox(service=service, options=options)
browser.get("https://www.google.com")
action = ActionChains(browser)
action.scroll_by_amount(0, 200)
action.perform()

Stacktrace

Traceback (most recent call last):
  File "gui/test.py", line 15, in <module>
    action.perform()
  File "/opt/python/python-3.7.9/lib/python3.7/site-packages/selenium/webdriver/common/action_chains.py", line 73, in perform
    self.w3c_actions.perform()
  File "/opt/python/python-3.7.9/lib/python3.7/site-packages/selenium/webdriver/common/actions/action_builder.py", line 91, in perform
    self.driver.execute(Command.W3C_ACTIONS, enc)
  File "/opt/python/python-3.7.9/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "/opt/python/python-3.7.9/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: Unknown action type: [object String] "wheel"
Stacktrace:
WebDriverError@chrome://remote/content/shared/webdriver/Errors.jsm:181:5
InvalidArgumentError@chrome://remote/content/shared/webdriver/Errors.jsm:310:5
assert.that/<@chrome://remote/content/marionette/assert.js:456:13
assert.in@chrome://remote/content/marionette/assert.js:409:47
fromJSON@chrome://remote/content/marionette/action.js:464:12
fromJSON@chrome://remote/content/marionette/action.js:842:39
fromJSON@chrome://remote/content/marionette/action.js:805:48
performActions@chrome://remote/content/marionette/actors/MarionetteCommandsChild.jsm:448:20
receiveMessage@chrome://remote/content/marionette/actors/MarionetteCommandsChild.jsm:141:31

Trace-level log

geckodriver.log

whimboo commented 1 year ago

wheel actions have been implemented in Firefox 106 (see bug) and geckodriver 0.32.0. So you only have to upgrade your Firefox version.

titusfortner commented 1 year ago

Oh! I missed that this was an old version of Firefox when I redirected the issue here.

hoba87 commented 1 year ago

@whimboo Thanks!