在执行脚本时,有时候引用一些元素对象会抛出如下异常

  org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document

按字面表达的意思大概是,所引用的元素已过时,不再依附于当前页面。通常情况下,这是因为页面进行了刷新或跳转,解决方法是,重新使用 findElement 或 findElements 方法进行元素定位即可。

stale element reference: element is not attached to the page document 异常的更多相关文章

  1. 关于报错stale element reference: element is not attached to the page document处理

    1.现象 在执行脚本时,有时候引用一些元素对象会抛出如下异常 org.openqa.selenium.StaleElementReferenceException: stale element ref ...

  2. 报错stale element reference: element is not attached to the page document结局方案

    今天在调试脚本时,遇到如下报错: org.openqa.selenium.StaleElementReferenceException: stale element reference: elemen ...

  3. selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document

    抓取网页代码后,由于是在同一个li标签下,所以使用一次性抓取,所有的a标签,然后循环做不同的操作,但是抛出找不到元素异常. def office_page(_chrome: Chrome): sn = ...

  4. 【问题记录】element is not attached to the page document

    遇到ui脚本报错:element is not attached to the page document 解决办法,再次定位即可

  5. Selenium2学习-012-WebUI自动化实战实例-010-解决元素失效:StaleElementReferenceException: stale element reference: element is not attached to the page document

    元素失效的想象提示信息如下图所示,此种问题通常是因为元素页面刷新之后,为重新获取元素导致的. 解决此类问题比较简单,只需要在页面刷新之后,重新获取一下元素,就可以消除此种错误了. 以下以易迅网搜索为例 ...

  6. Selenium 错误处理之:stale element reference: element is not attached to the page document

    出现该错误的原因是页面在获取到DOM元素之后到引用元素之间页面进行了刷新,所以需要再次获取该DOM元素即可.

  7. Is it possible to implement a Firebug-like “inspect element” DOM element highlighter with client-side JavaScript?

    Is it possible to implement a Firebug-like "inspect element" DOM element highlighter with ...

  8. Webdriver如何解决页面元素过期:org.openqa.selenium.StaleElementReferenceException: Element not found in the cache - perhaps the page has changed since it was looked up

    当运行Webdriver时抛出如下异常:org.openqa.selenium.StaleElementReferenceException: Element not found in the cac ...

  9. selenium+python自动化88-批量操作循环点击报错:Element not found in the cache - perhaps the page has changed since it was looked up

    前言 selenium定位一组元素,批量操作循环点击的时候会报错:Element not found in the cache - perhaps the page has changed since ...

随机推荐

  1. 062 hive中的常用方法(case,cast,unix_timestamp)

    1.case的用法 )格式1 case col when value then '' when value then '' else '' end )格式2 case when col='value' ...

  2. [OpenCV-Python] OpenCV 中计算摄影学 部分 IX 对象检测 部分 X

    部分 IX计算摄影学 OpenCV-Python 中文教程(搬运)目录 49 图像去噪目标 • 学习使用非局部平均值去噪算法去除图像中的噪音 • 学习函数 cv2.fastNlMeansDenoisi ...

  3. Netty handler处理类无法使用@Autowired注入bean的解决方法

    问题由来: 公司有个项目用到netty作为websocket的实现,最近打算部署双机,这使得原来在内存中的保存Channel信息的方案不再可行,需要转移到redis中,改造过程中发现通过@Autowi ...

  4. 细说Vue作用域插槽,匹配应用场景。

    最近在官方文档中看到,vue新增了一种插槽机制,叫做作用域插槽.要求的版本是2.1.0+. 首先来说一下:顾名思义,所谓作用域插槽,主要就在作用域,需要注意的是(以下几点看不懂不要紧,配合下面的例子, ...

  5. 算法进阶面试题03——构造数组的MaxTree、最大子矩阵的大小、2017京东环形烽火台问题、介绍Morris遍历并实现前序/中序/后序

    接着第二课的内容和带点第三课的内容. (回顾)准备一个栈,从大到小排列,具体参考上一课.... 构造数组的MaxTree [题目] 定义二叉树如下: public class Node{ public ...

  6. File类基本用法

    [例子1]创建一个新文件. import java.io.*; class hello{ public static void main(String[] args) { File f=new Fil ...

  7. 洛谷.4180.[模板]次小生成树Tree(Kruskal LCA 倍增)

    题目链接 构建完MST后,枚举非树边(u,v,w),在树上u->v的路径中找一条权值最大的边(权为maxn),替换掉它 这样在 w=maxn 时显然不能满足严格次小.但是这个w可以替换掉树上严格 ...

  8. Java 8新特性----Lambda

    Lambda 一.如何辨别Lambda表达式 Runnable noArguments = () -> System.out.println("Hello World"); ...

  9. input输入框只能输入数字而且开头不能为零

    <div class="input-choseNum"> <input type="number" id="inp-chooseNu ...

  10. Spark MLlib 之 Vector向量深入浅出

    Spark MLlib里面提供了几种基本的数据类型,虽然大部分在调包的时候用不到,但是在自己写算法的时候,还是很需要了解的.MLlib支持单机版本的local vectors向量和martix矩阵,也 ...