最近在做测试的时候发现driver.find_element_by_id的源代码改了如下:
driver.find_element_by_id("j_username").send_keys("wanjiayang")  # 填入用户名
driver.find_element_by_id("j_password").send_keys("19980618.wanjia")  # 填入密码

继续使用会报错AttributeError: 'WebDriver' object has no attribute 'find_element_by_id'。

源码改为

def find_element(self, by=By.ID, value=None) -> WebElement:"""Find an element given a By strategy and locator.:Usage:::element = driver.find_element(By.ID, 'foo'):rtype: WebElement"""

这样就正常登录了

 driver.find_element(By.ID, "j_username").send_keys("wanjiayang")  # 填入用户名driver.find_element(By.ID, "j_password").send_keys("19980618.wanjia")  # 填入密码

AttributeError: ‘WebDriver‘ object has no attribute ‘find_element_by_id‘相关推荐

  1. AttributeError: ‘WebDriver‘ object has no attribute ‘w3c‘

    size = driver.get_window_size() # 获取手机屏幕大小,分辨率 print(size) 报错 AttributeError: 'WebDriver' object has ...

  2. 解决‘WebDriver‘ object has no attribute ‘find_element_by_xpath‘问题

    'WebDriver' object has no attribute 'find_element_by_xpath'问题 以前习惯使用WebDriver来直接操作,比如: dr = webdrive ...

  3. AttributeError: ‘LoginPage‘ object has no attribute ‘driver‘

    #简单的po模式 #2022/8/7 from selenium import webdriver from selenium.webdriver.common.by import Byclass L ...

  4. Python错误:AttributeError: 'generator' object has no attribute 'next'解决办法

    今天在学习生成器对象(generation object)运行以下代码时,遇到了一个错误: #定义生成器函数 def liebiao(): for x in range(10): yield x #函 ...

  5. AttributeError: 'dict' object has no attribute 'status_code'

    前端AJAX请求数据,提示错误:"AttributeError: 'dict' object has no attribute 'status_code'". 原因:是提示返回对象 ...

  6. Traceback (most recent call last): File AttributeError: 'NoneType' object has no attribute 'group'

    Traceback (most recent call last):File "<stdin>", line 1, in <module> Attribut ...

  7. 解决:AttributeError: ‘Graph‘ object has no attribute ‘number_of_selfloops‘

    解决:AttributeError: 'Graph' object has no attribute 'number_of_selfloops' 目录 解决:AttributeError: 'Grap ...

  8. AttributeError: ‘FPDF‘ object has no attribute ‘unifontsubset‘

    AttributeError: 'FPDF' object has no attribute 'unifontsubset' 目录 AttributeError: 'FPDF' object has ...

  9. AttributeError: ‘Series‘ object has no attribute ‘as_matrix‘

    AttributeError: 'Series' object has no attribute 'as_matrix' 问题: y_test = test_shifted["y_t+1&q ...

最新文章

  1. 记一次订单号的重复事故
  2. Shell中的${}、##和%%使用范例
  3. eclipse常用快捷键汇总
  4. 计算机专业人大学排名,计算机专业学校排名哪些大学计算机专业比较好
  5. 【数据结构】之基本概念和术语
  6. Redis 是属于多线程还是单线程?
  7. Spring Cloud Ribbon –进行安全呼叫
  8. css 可编辑,如何设置DIV可编辑
  9. 制作作品图片_不懂人文后期制作流程?来,大师手把手教你
  10. 虚拟ip(VIP)实现原理
  11. 使用setBounds()函数设置Java布局
  12. 台式计算机无线网络连接打印机,台式机怎么样连接无线打印机
  13. 集合——数组容器笔记
  14. 杭电OJ第11页2075~2079算法题(C语言)
  15. @Transactional的四种隔离级别测试
  16. GAE 博客——B3log Solo 0.2.1 发布了!
  17. 22届春季校招实习试水之路1(Java后端)
  18. 运维之红帽管理员篇-----1. Linux系统简介 、 安装RHEL7系统 、 RHEL7基本操作
  19. <学习笔记> VBA_Line list_01
  20. link和@import的区别:

热门文章

  1. 【浅析三元锂与磷酸铁锂电池】
  2. 我的2011----再见2011!你好2012!
  3. 2023年哪款手机浏览器比较好用,最后一个吹爆它
  4. Godot教程中文版-脚本2(Scripting2)
  5. 客厅智能化(1、2)
  6. python实现语音播放_用Python播放音频,并实现倍速播放——pyaudio模块用法(1)-nrg文件怎么播放...
  7. MP4文件播放不了是什么原因?原因及解决办法分享!
  8. com.android.vovo,Android仿ViVO X6 极速闪充动画效果
  9. 社交社区论坛APP超高颜值UI界面
  10. 区块连中文书六本略读