ActionChains報錯問題總結


在使用Python2.7+Selenium3.0.2+Firefox50.1時,鼠標事件ActionChains運行總是報錯,報錯信息如下:

C:\Python36\python3.exe C:/Users/root/PycharmProjects/untitled3/test170117.py
Traceback (most recent call last):
  File "C:/Users/root/PycharmProjects/untitled3/test170117.py", line 458, in <module>
    ActionChains(driver).move_to_element(set).perform()
  File "C:\Python36\lib\site-packages\selenium\webdriver\common\action_chains.py", line 74, in perform
    action()
  File "C:\Python36\lib\site-packages\selenium\webdriver\common\action_chains.py", line 225, in <lambda>
    Command.MOVE_TO, {'element': to_element.id}))
  File "C:\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "C:\Python36\lib\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/3ba988a1-5c6f-4999-8815-71d40e62a6af/moveto did not match a known command
 
經過搜索,說是geckodriver和Firefox有Bug,最后將Selenium3.0.2換成Selenium2.53.0(此時環境為Python2.7+Selenium2.53.0+Firefox50.1),此時運行python腳本時,報錯:
報錯信息忘了截圖了?????
搜索后,說是因為Selenium支持Firefox及其以下版本,所以最后環境變為:Python2.7+Selenium2.53.0+Firefox46,問題解決,ActionChains()類下的各種鼠標操作方法完美運行。
github上該Bug相關信息:
https://github.com/SeleniumHQ/selenium/issues/2285
https://github.com/mozilla/geckodriver/issues/159


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM