在输入框输入内容,点击【查询】,然后点击页面上的【处理】,并进行点击时,报错,报错内容如下。
selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document

原代码:
#点击处理按钮
driver.find_element_by_id(‘ctl00_ContentPlaceHolder_RadGridList_ctl00_ctl04_btnHandle’).click()

参考博文后,加上了try except方法,成功点击了【处理】按钮,打开了新的页面。
https://blog.csdn.net/DaxiaLeeSuper/article/details/93747693

更新后代码:
e2=driver.find_element_by_id(‘ctl00_ContentPlaceHolder_RadGridList_ctl00_ctl04_btnHandle’)
print(e2.text)
try:
e2.click()
except Exception:
print(“出错了”)
e2 = driver.find_element_by_id(‘ctl00_ContentPlaceHolder_RadGridList_ctl00_ctl04_btnHandle’)
e2.click()

selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element相关推荐

  1. 已解决 selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element 找不到元素的问题

    场景 使用selenium的find_element_by_xpath()函数报错:selenium.common.exceptions.NoSuchElementException: Message ...

  2. 已解决selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted:

    已解决python selenium模块自动化操作浏览器点击元素,抛出异常selenium.common.exceptions.ElementClickInterceptedException: Me ...

  3. selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate elemen

    selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate elemen ...

  4. 解决selenium用cookies时候报错selenium.common.exceptions.InvalidArgumentException: Message: invalid argument

    报错如下: selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: invalid 'xxxxx ...

  5. 报错:selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This versio

    报错: selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This versio ...

  6. selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘ executable needs to bein PATH

    使用Selenium模拟浏览器访问淘宝首页,出现报警 from selenium import webdriver import timebrowser = webdriver.Chrome() br ...

  7. selenium.common.exceptions.WebDriverException: Message: ‘chromedriver’解决

    selenium.common.exceptions.WebDriverException: Message: 'chromedriver'解决: https://blog.csdn.net/weix ...

  8. 已解决 selenium.common.exceptions.NoSuchWindowException: Message: no such window

    D:\学习\Python工程\venv\Scripts\python.exe "D:\软件\PyCharm Community Edition 2019.1.3\plugins\python ...

  9. 已解决selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

    已解决selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary ...

最新文章

  1. 小圈子.大社交:利用圈子引爆流行
  2. 在eclipse中查看Android源代码
  3. 按时间取天和月的数据,和字符串截取函数
  4. 清华学霸直博简历火了:CPU、操作系统、编译器全自己写
  5. 关于中断和异常的几点认识
  6. 使用nrm管理npm源的切换
  7. 精益标准工时软件VIOOVI:没有标准工时,别谈精益改善!
  8. js创建a标签下载文件
  9. 浏览器h5拉起app 微信拉起app wx-launch-open-app
  10. 健身运动App需求分析
  11. eWebEditor的使用
  12. SitePoint播客#158:饮酒与技术
  13. ORA-29491: invalid table for chunking 错误记录
  14. 安安猜价格聪明机器人_2021年智慧树APP不动产估价第八单元章节测试答案
  15. 浅谈VMware的NAT模式
  16. [引擎搭建记录] 遮罩加速的软光栅遮挡剔除
  17. java坦克大战 实训报告_程序设计实训坦克大战实验报告
  18. 项目中使用过的Soc
  19. 触发浏览器回流的属性方法一览表
  20. 中职计算机专业英语课件,计算机专业英语课件—unit 1.ppt

热门文章

  1. 用完HttpWebResponse时别忘了调用Close方法
  2. 利用 Conda 尝鲜 Python 3.10 不一样的特性 快来试试
  3. php 利用redis写一个聊天室,使用Redis完成聊天室功能
  4. 小学计算机教师集体备课计实,教师集体备课活动记录表.doc
  5. elementui tree获取父节点_elementUI 树状图 点击子节点获取父节点
  6. Linux驱动段错误,linux驱动调试--段错误之oops信息分析
  7. oracle vm win10,win10系统oraclevm卸载不了错误2503的解决方法
  8. CFileStatus 使用详解
  9. 信息源按加工深度划分_工程勘察时如何划分地层?勘查总工实力整理
  10. 5件你可能不知道可以使用 CSS-in-JS 来做的事情