51Testing软件测试论坛
标题:
selenium 模拟鼠标右键报错?
[打印本页]
作者:
悠悠小仙仙
时间:
2017-11-29 16:17
标题:
selenium 模拟鼠标右键报错?
#coding:utf-8
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Firefox() #打开浏览器
driver.get("Http://www.baidu.com")
#定位到元素
right = driver.find_element_by_id('su')
print "定位到搜索框"
#执行元素鼠标右键操作
ActionChains(driver).context_click(right).perform()
复制代码
报错了
/usr/bin/python2.7 /home/stephen/PycharmProjects/python/selenium2/5.鼠标右键.py
Traceback (most recent call last):
定位到搜索框
File "/home/stephen/PycharmProjects/python/selenium2/5.鼠标右键.py", line 12, in <module>
ActionChains(driver).context_click(right).perform()
File "/home/stephen/.local/lib/python2.7/site-packages/selenium/webdriver/common/action_chains.py", line 74, in perform
action()
File "/home/stephen/.local/lib/python2.7/site-packages/selenium/webdriver/common/action_chains.py", line 225, in <lambda>
Command.MOVE_TO, {'element': to_element.id}))
File "/home/stephen/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "/home/stephen/.local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: POST /session/428be644-5484-425f-8bfb-10800d287143/moveto did not match a known command
Process finished with exit code 1
复制代码
查了好多答案 没找到为什么故来求助啊 ?
作者:
lsekfe
时间:
2017-11-29 16:37
Chrome是没问题的,webdriver目前对于Firefox的支持还不到位,是个已知的bug
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2