selenium Element not found in the cache错误(涉及源码分析)

先看下报错信息File "/root/pro/G_spider/weibo_spider/src1/src/get.py", line 190, in load_footer_weibo footer[0].click() File "/usr/local/lib/python2...
摘要由CSDN通过智能技术生成

先看下报错信息

File "/root/pro/G_spider/weibo_spider/src1/src/get.py", line 190, in load_footer_weibo
    footer[0].click()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 65, in click
    self._execute(Command.CLICK_ELEMENT)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 402, in _execute
    return self._parent.execute(command, params)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 175, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 166, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.StaleElementReferenceException: Message: Element not found in the cache - perhaps the page has changed since it was looked up
Stacktrace:
    at fxdriver.cache.getElementAt (resource://fxdriver/modules/web-element-cache.js:8953)
    at Utils.getElementAt (file:///tmp/tmp7_TdRV/extensions/fxdriver@googlecode.com/components/command-processor.js:8546)
    at fxdriver.preconditions.visible (file:///tmp/tmp7_TdRV/extensions/fxdriver@googlecode.com/components/command-processor.js:9585)
    at DelayedCommand.prototype.checkPreconditions_ (file:///tmp/tmp7_TdRV/extensions/fxdriver@googlecode.com/components/command-processor.js:12257)
    at DelayedCommand.prototype.executeInternal_/h (file:///tmp/tmp7_TdRV/extensions/fxdriver@googlecode.com/components/command-processor.js:12274)
    at DelayedCommand.prototype.executeInternal_ (file:///tmp/tmp7_TdRV/extensions/fxdriver@googlecode.com/components/command-processor.js:12279)
    at DelayedCommand.prototype.execute/< (file:///tmp/tmp7_TdRV/extensions/fxdriver@googlecode.com/components/command-processor.js:12221)

首先来分析一下这个错误,错误始于footer[0].click() 这里,footer是我程序中获取到的一个element,element点击之后,触发了一下一大堆问题。。。= =

我们顺着错误信息下去,可以发现错误信息都是来自

webdriver/remote:

  • self._execute(Command.CLICK_ELEMENT)—webelement.py

这个代码意思就很明显了,执行一个点击元素命令

  • return self._parent.execute(command, params)—webelement.py

这个是在self下的_parent执行一个command

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值