selenium Element not found in the cache - perhaps the page has changed since it was looked up。这个问题爆出以后,找了各种解决的方法,始终不能正常解决。

最后找到了一个方法,上边提示说可以尝试在页面刷新后重新 find元素。就把查找基本元素的方法挪了下位置,在页面刷新后,在次查找需要处理的集合,找到后在进行处理。问题解决,最后发现,这个问题彻底解决了,哎。写代码要谨慎啊。页面存在多种连接时,可能一行既有图片又有文字连接,找到后分开放了2个集合。一个点击完后,在点击后一个集合,就会出现上边的错误,这个也很合理啊,页面的元素都已经刷新了,这个集合就改变了,就找不到,必须重新查找,缓存失效了。在每个页面打开后,要记得 _driver.Navigate().Back();返回上个链接。这个所有的连接地址都是在同一个页面开始的。

selenium Element not found in the cache - perhaps the page has changed since it was looked up接解决的更多相关文章

  1. 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 ...

  2. 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 ...

  3. java selenium后报错Element not found in the cache元素定位要重新赋值之前的定义

    习惯上把定位的元素在操作之前就定位好, 例如: WebElement element1=driver.findElement(...);      ----------declaration1 Web ...

  4. selenium之 坑(StaleElementReferenceException: Message: Element not found in the cache...)

    今天给大家分享一个selenium中经常会有人遇到的坑: selenium.common.exceptions.StaleElementReferenceException: Message: Ele ...

  5. selenium之坑:点击后页面刷新重新获取刷新前的页面(StaleElementReferenceException:Message:Element not found in the cache...)

    循环点击一列链接,但只能点到第一个,第二个失败,这是为什么,因为第二个已经是新页面,当然找不到之前页面的元素,虽然元素没变,甚至是后退回来,页面都没有变,为什么是新页面,页面长的一样不代表是同一张页面 ...

  6. selenium之坑(StaleElementReferenceException: Message: Element not found in the cache...)

    有时候循环点击一列链接,只能点到第一个,第二个就失败了 原因是第二个已经是新页面,当然找不到之前页面的元素.就算是后退回来的,页面也是不一样的 页面长的一样不一定是同一张页面,就像两个人长的一样不一定 ...

  7. 参考:(Java Selenium)Element is not visible to clcik

    1.The element is not visible to click. Use Actions or JavascriptExecutor for making it to click. By ...

  8. Python Selenium element is not reachable by keyboard

    碰到这个问题,没法解决, 最后这么搞的 pcAction.move_by_offset(571, 534).click().perform() #激活输入框 driver.switch_to.acti ...

  9. java+Selenium+TestNg搭建自动化测试架构(3)实现POM(page+Object+modal)

    1.Page Object是Selenium自动化测试项目开发实践的最佳设计模式之一,通过对界面元素的封装减少冗余代码,同时在后期维护中,若元素定位发生变化,只需要调整页面元素封装的代码,提高测试用例 ...

随机推荐

  1. [USACO19FEB]Moorio Kart(DP)

    Luogu5243 题解 即O(N^2)暴力统计出每个森林的路径,从ctgn个集合中各选出一个数,使得长度>=Y的方案数. 用背包统计.具体实现: \(dp[i+j][0]\leftarrow ...

  2. Codeforces Round #334(div.2)(新增不用二分代码) B

    B. More Cowbell time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  3. pandas关于其他merge用法(df1的的列索引和df2的行索引对应时候的)

  4. Spring Boot学习资料汇总

    1. SpringFramework 重点学习 IOC容器,Web MVC framework,AOP 等    官网文档  http://docs.spring.io/spring/docs/cur ...

  5. 增加tomcat多实例

    第一步:解压 第二步:修改端口 /data/service/tomcat1/conf <Server port="8006" shutdown="SHUTDOWN& ...

  6. python模块之openpyxl介绍

    openpyxl模块是一个读写Excel 2010文档的Python库,如果要处理更早格式的Excel文档,需要用到额外的库,openpyxl是一个比较综合的工具,能够同时读取和修改Excel文档.其 ...

  7. 学习ssm

    1.安装配置maven (1)在http://maven.apache.org/download.cgi下载apach-maven-3.5.4-bin.zip (2)将apach-maven-3.5. ...

  8. JS中==、===和Object.is()的区别

    JS中==.===和Object.is()的区别 首先,先粗略了解一下这三个玩意儿: ==:等同,比较运算符,两边值类型不同的时候,先进行类型转换,再比较: ===:恒等,严格比较运算符,不做类型转换 ...

  9. Dev Express Report 学习总结(五)在分组中使用聚集表达式AggregateExpression

    聚集表达式AggregateExpression主要包括几种:Avg(),Count(),Exists(),Max(),Min(),Single()和Sum().其中对于Sum(),在我看来主要有两种 ...

  10. g++ -I(大写i) 与-L(大写l)-l(小写l) 的作用与学习

    linux 下 g++编译程序时,-I(大写i) 与-L(大写l)-l(小写l) 的作用 作为一个linux入门级使用者,gcc/g++ 的简单操作已经用过多次, 但是有时稍微复杂一点的程序就会使用到 ...