Question for using move_to_element_with_offset command

50 views
Skip to first unread message

Colin Lam

unread,
Aug 25, 2016, 9:15:04 AM8/25/16
to Selenium Users
Hi everyone,

I am trying to do some clicking automation using selenium.
Basically what I want to do is to move the mouse to perform a clicking event using action.move_to_element_with_offset command.
Here is my code.

from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import argparse
import time

def main():

    browser
= webdriver.Firefox()
    browser
.get(url)
    map_element
= browser.find_element_by_id('map3d')

    time
.sleep(10)

    action
= ActionChains(browser)
    action
.move_to_element_with_offset(map_element, 1, 1).click().perform()

if __name__ == '__main__':
    main
()



However, I have the error as:
 File "autoClick.py", line 42, in <module>
   main()
 File "autoClick.py", line 27, in main
   action.move_to_element_with_offset(map_element, 1, 1).click().perform()
 File "C:\Python27\lib\site-packages\selenium\webdriver\common\action_chains.py
, line 74, in perform
   action()
 File "C:\Python27\lib\site-packages\selenium\webdriver\common\action_chains.py
, line 242, in <lambda>
   'yoffset': int(yoffset)}))
 File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", l
ne 236, in execute
   self.error_handler.check_response(response)
 File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py"
 line 192, in check_response
   raise exception_class(message, screen, stacktrace)
elenium.common.exceptions.WebDriverException: Message: POST /session/892f4979-a
cf-4a0c-a7ec-3da47f87230f/moveto did not match a known command

Does anyone how I can fix this?
I am using Geckodriver.exe with selenium3.0.0b2 python bindings, in FireFox 48.0.2.

Many thanks!

Colin
Reply all
Reply to author
Forward
0 new messages