报错stale element reference: element is not attached to the page document结局方案
今天在调试脚本时,遇到如下报错:
org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document
按字面表达的意思大概是,所引用的元素已过时,不再依附于当前页面。通常情况下,这是因为页面进行了刷新或跳转,
下面说下我的情况:
我进入页面dom结构,查看发现原来table表格的id实时自增,即id=id++;这种模式,坑死了,加上度娘找的自己理解,终于解决了该问题解决方案如下:
- 因为是动态id,也就是说实时刷新,因此采取相对路径定位, xpath加and锁定定位条件,建议至少两个约束。
- 进到列表页时,先执行refresh方法,在获取到当前列集合,在去操作想要操作元素即可。
报错stale element reference: element is not attached to the page document结局方案的更多相关文章
- 关于报错stale element reference: element is not attached to the page document处理
1.现象 在执行脚本时,有时候引用一些元素对象会抛出如下异常 org.openqa.selenium.StaleElementReferenceException: stale element ref ...
- selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
抓取网页代码后,由于是在同一个li标签下,所以使用一次性抓取,所有的a标签,然后循环做不同的操作,但是抛出找不到元素异常. def office_page(_chrome: Chrome): sn = ...
- mybatis项目启动报错 The content of element type "resultMap" must match "(constructor?,id*,result*,association*,collection*,discriminator?)".
启动项目报错 2018-02-26 17:09:51,535 ERROR [org.springframework.web.context.ContextLoader] - Context initi ...
- 关于xpath语句完全正确,但是页面报错: no such element: Unable to locate element: {"method":"xpath","selector":"xpath"}
之前使用selenium-webdriver来写UI的自动化脚本,发现有一个元素一直无法定位,查看其源码,如下 利用xpathChecker验证了xpath语句的是正确的,但是控制台一直报错: no ...
- stale element reference: element is not attached to the page document 异常
在执行脚本时,有时候引用一些元素对象会抛出如下异常 org.openqa.selenium.StaleElementReferenceException: stale element referenc ...
- java报错:The reference to entity "characterEncoding" must end with the ';' delimiter.
java关于报错:The reference to entity "characterEncoding" must end with the ';' delimiter. Java ...
- 【问题记录】element is not attached to the page document
遇到ui脚本报错:element is not attached to the page document 解决办法,再次定位即可
- 记录微信小程序报错 Unexpected end of JSON input;at pages/flow/checkout page getOrderData function
微信小程序报错 Unexpected end of JSON input;at pages/flow/checkout page getOrderData function 这个报错是在将数组对象通过 ...
- Selenium2学习-012-WebUI自动化实战实例-010-解决元素失效:StaleElementReferenceException: stale element reference: element is not attached to the page document
元素失效的想象提示信息如下图所示,此种问题通常是因为元素页面刷新之后,为重新获取元素导致的. 解决此类问题比较简单,只需要在页面刷新之后,重新获取一下元素,就可以消除此种错误了. 以下以易迅网搜索为例 ...
随机推荐
- 如何用Qt自动拷贝exe依赖的dll
QT生成的.exe文件不能运行的解决办法 之前的数独项目的GUI,当我的Qt项目生成exe时,由于缺少了相关的依赖dll文件,打开会一直报缺少依赖文件的错: 然后一开始我到安装的Qt文件夹里把这些有Q ...
- [转帖]Programmer’s guide to the big tech companies 💻
Programmer’s guide to the big tech companies
- [搜狐科技]由浅入深理解Raft协议
由浅入深理解Raft协议 2017-10-16 12:12操作系统/设计 0 - Raft协议和Paxos的因缘 读过Raft论文<In Search of an Understandable ...
- Exploring Pyramids UVALive - 3516 (记忆化DP)
题意:给定一个序列 问有多少棵树与之对应 题目连接:https://cn.vjudge.net/problem/UVALive-3516 对于这一序列 分两种2情况 当前分支 和 其它分支 用df ...
- 51Nod 1199 Money out of Thin Air (树链剖分+线段树)
1199 Money out of Thin Air 题目来源: Ural 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 收藏 关注 一棵有N个节点的树,每 ...
- 【BZOJ2178】圆的面积并(辛普森积分)
[BZOJ2178]圆的面积并(辛普森积分) 题面 BZOJ 权限题 题解 把\(f(x)\)设为\(x\)和所有圆交的线段的并的和. 然后直接上自适应辛普森积分. 我精度死活一个点过不去,不要在意我 ...
- 【BZOJ4260】Codechef REBXOR (Trie树)
[BZOJ4260]Codechef REBXOR (Trie树) 题面 BZOJ 题解 两眼题.第一眼不会做,第二眼好简单... 前缀异或和一下,拿\(Trie\)树维护求一个在这个端点以左的最大值 ...
- USACO Section 1.4 Mother's Milk 解题报告
题目 题目描述 有三个牛奶桶,三个桶的容积分别是A,B,C,最小为1,最大为20.刚开始只有第三个桶里面装满了牛奶,其余两个桶都是空的.我们现在可以将第三个桶中的牛奶往其他两个桶里面倒一些牛奶,然后还 ...
- (转)JDK工具-javadoc命令
背景:最近在学习java基础知识,看到文档注释部分,一种是在dos命令下生成api文件,另一种是在eclipse下生成api文件.dos方式在<疯狂java讲义>中有详细的说明,eclip ...
- phpstorm 配置 webpack @ 别名跳转
webstorm中专门有webpack的相关配置,默认的路径直接是项目根目录下的 webpack.config.js,但是我们用各种cli生成的项目中,webpack的配置一般都是在build下,导致 ...