'WebDriver' object has no attribute 'find_element_by_tag_name'

简介: 'WebDriver' object has no attribute 'find_element_by_tag_name'

出现这个问题的原因还是selenium版本问题,高版本的seleniunm不是这样的写法。
首先需要导入对应的包:

from selenium.webdriver.common.by import By

新版本的定位方式:

selenium中find_element定位方式
find_element(By.XPATH)
find_element(By.CSS_SELECTOR)
find_element(By.ID)
find_element(By.TAG_NAME)
find_element(By.class_name,)
find_element(By.PARTIAL_LINK_TEXT)
find_element(By.LINK_TEXT)
find_element(By.name)

参考博客

目录
相关文章
|
2月前
|
计算机视觉 Python
解决 NoneType‘ object has no attribute ‘astype’ 问题
解决 NoneType‘ object has no attribute ‘astype’ 问题
30 0
|
6月前
|
存储 JSON 数据格式
数据集加载时报错'dict' object has no attribute 'requests‘
数据集加载时报错'dict' object has no attribute 'requests‘
113 5
|
4月前
AttributeError: 'NoneType' object has no attribute 'to_capabilities'
AttributeError: 'NoneType' object has no attribute 'to_capabilities'
377 0
|
7月前
|
Python Windows
xlrd库报错【AttributeError: ‘ElementTree‘ object has no attribute ‘getiterator‘】
xlrd库报错【AttributeError: ‘ElementTree‘ object has no attribute ‘getiterator‘】
119 0
|
4月前
AttributeError ‘NoneType‘ object has no attribute ‘to_capabilities‘
AttributeError ‘NoneType‘ object has no attribute ‘to_capabilities‘
93 0
|
5月前
|
数据采集
运行爬虫时报错AttributeError—— 'str' object has no attribute 'capabilities'
运行爬虫时报错AttributeError—— 'str' object has no attribute 'capabilities'
255 0
|
9月前
yolov7—tensorrt报错AttributeError: ‘NoneType‘ object has no attribute ‘execute_v2‘已解决。
yolov7—tensorrt报错AttributeError: ‘NoneType‘ object has no attribute ‘execute_v2‘已解决。
90 0
yolov7—tensorrt报错AttributeError: ‘NoneType‘ object has no attribute ‘execute_v2‘已解决。
|
9月前
|
PyTorch 算法框架/工具
已解决虚拟机yolov5报错:AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘
已解决虚拟机yolov5报错:AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'
216 0
已解决虚拟机yolov5报错:AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘
|
9月前
|
Python
AttributeError: 'dict' object has no attribute 'has_key'
AttributeError: 'dict' object has no attribute 'has_key'
|
9月前
|
Python
Python3 ‘str‘ object has no attribute ‘decode‘. Did you mean: ‘encode‘?
Python3 ‘str‘ object has no attribute ‘decode‘. Did you mean: ‘encode‘?
172 0