在运行webdriver调用ActionChains(driver).click_and_hold(on_element=element).perform()时抛出selenium.common.exceptions.WebDriverException异常,firefox版本51.0.1,在stackoverflow上找到别人遇到的同样的问题点击打开链接,其中第一个回答如下:
Sadly this appears to be a bug in the Mozilla/geckodriver side of the Actions implementation that has been lingering since mid 2016. If you really need this, switch to something not Firefox or grab a pre-geckodriver Firefox (47 or below, I believe) and use the older webdriver bindings (i.e., Selenium 2). Unfortunately, it is not as easy as just getting the older FF version.
译文如下:
很遗憾的是这是一个Mozilla/geckodriver中用户操作(Actions)实现代码中的bug,这个bug从2016年年中就存在了一直到今天。如果你真想用这个功能,那么就别用firefox或者将firefox的版本降级到47(我认为是这个版本,仅供参考)号版本或以下,以及另一个方法使用更早的webdriver版本(比如selenium2中的webdriver)。很不幸的是获取老版本的FF并不容易。