网页中有一个脚本,允许您查看视频和其他内容。在
使用python和selenium不能在鼠标点击后运行脚本。使用此代码的当前am的:videoGemPath = ".//*[@id='brandconnect']/a/img"
scriptPath = ".//*[@id='content']/script"
elementScript = "/html/body/div[2]/div[1]"
location = driver.find_element_by_xpath(scriptPath)
ActionChains(driver).move_to_element(location).click().perform()
但它返回这个错误
在=========================================================================
回溯(最近一次呼叫):
文件“C:\Users\xxxxxx\Desktop\Proggetti VB\Per Web\PythonApplication4\PythonApplication4.py”,第66行,在test\u登录中
ActionChains(驱动程序)。将\u移动到\u元素(位置)。click().perform()
文件“C:\Python27\lib\site packages\selenium-2.48.0-py2.7.egg\selenium\webdriver\common\action_链.py“,第72行,执行中
动作()
文件“C:\Python27\lib\site packages\selenium-2.48.0-py2.7.egg\selenium\webdriver\common\action_链.py“,第217行,英寸
自我_驱动程序.执行(命令。移动到,{'element':到_元素.id}))
文件“C:\Python27\lib\site packages\selenium-2.48.0-py2.7.egg\selenium\webdriver\remote\网络驱动程序.py“,第201行,执行中
self.error_处理程序.检查_响应(response)
文件“C:\Python27\lib\site packages\selenium-2.48.0-py2.7.egg\selenium\webdriver\remote\错误处理程序.py“,第181行,在check\u响应中
引发异常_类(消息、屏幕、stacktrace)
MoveTargetAutofBoundsException:消息:无法将元素内的偏移量滚动到视图中:(352.5,241.5):[object HTMLScriptElement]
堆栈跟踪:
在FirefoxDriver.prototype.mousemovoito(文件:///c:/users/xxxxxx/appdata/local/temp/tmpgnvb0k/extensions/fxdriver@googlecode.com/components/driver-component.js:10961)
在DelayedCommand.prototype.executeInternal_200;/h(文件:///c:/users/xxxxxx/appdata/local/temp/tmpgnvb0k/extensions/fxdriver@googlecode.com/components/command-processor.js:12534)
在DelayedCommand.prototype.executeInternal\(文件:///c:/users/xxxxxx/appdata/local/temp/tmpgnvb0k/extensions/fxdriver@googlecode.com/components/command-processor.js:12539)
在DelayedCommand.prototype.execute/<;(file:///c:/users/xxxxxxx/appdata/local/temp/tmpgnvb0k/extensions/fxdriver@googlecode.com/components/command-processor.js:12481)
=================================================================================
脚本代码如下:
^{pr2}$
我怎样才能修好它?在