【Python】处理 TypeError: ‘FirefoxWebElement‘ object is not iterable
编写下面的代码:
from selenium import webdriverdriver = webdriver.Firefox()
driver.maximize_window()
driver.implicitly_wait(50)
driver.get("http://www.baidu.com")
tag_names = driver.find_element_by_tag_name('input')
for tag_name in tag_names:print(tag_name)
print(type(tag_names))
driver.quit()
运行时报错:
TypeError: ‘FirefoxWebElement’ object is not iterable
错误原因是:错误地使用了API,实际上应该是find_elements_by_tag_name
没加s的话只是定位了单个元素,而加上s可以定义多个元素,才能返回可迭代的list对象!
运行结果示意:
【Python】处理 TypeError: ‘FirefoxWebElement‘ object is not iterable相关推荐
- Python报错TypeError: ‘User‘ object is not iterable
Python报错TypeError: 'User' object is not iterable 原因 User对象是不可迭代的,我这里是因为User并不是list,所以是不可迭代的,所以不使用迭代即 ...
- python常见错误 TypeError: 'NoneType' object is not iterable
TypeError: 'NoneType' object is not iterable 1. 将None赋给多个值时,会出现提示:TypeError: 'NoneType' object is no ...
- Python+selenium自动化测试:报错:TypeError: 'WebElement' object is not iterable
代码: # -*- coding: utf-8 -*-from selenium import webdriverfrom selenium.webdriver.common.by import By ...
- python nonetype_【已解决】Python程序错误:TypeError: ‘NoneType’ object is not iterable
[问题] 如下代码:def callBlogFunc(funcToCall, *paraList): funcName = funcToCall.func_name; if(blogIsNetease ...
- 个人报错TypeError: ‘type‘ object is not iterable
django报错 'type' object is not iterable,个人报错原因解析 E:\django_project\my_blog\article\models.py changed, ...
- 生成浮点数列表:Python range():TypeError: ‘float‘ object cannot be interpreted as an integer
生成浮点数列表:Python range():TypeError: 'float' object cannot be interpreted as an integer 目录 Python range ...
- 成功解决TypeError int object is not iterable
成功解决TypeError: 'int' object is not iterable 目录 解决问题 解决思路 解决方法 解决问题 TypeError: 'int' object is not it ...
- TypeError: 'float' object is not iterable
求心率的peason相关系数的时候遇到这个问题: TypeError: 'float' object is not iterable 解决方法: pre_label.extend(output) ty ...
- python 多进程multiprocessing进程池pool tensorflow-yolov3 报错TypeError: 'ApplyResult' object is not iterable
首先,代码结构它长这样: 可每次调用线程池进行识别时,就会报如下错误: D:\20191031_tensorflow_yolov3\python\python.exe D:/20191031_tens ...
最新文章
- 年入50万,程序员众生相
- Science:便携式DNA测序仪在检测病毒疫情中大显身手
- 计算机弹出错误字,电脑蓝屏,并且屏幕上出现这样的文字该怎么解决?
- php代码文字中怎么换行符,如何在imagestring(php中的文本到图像)中添加换行符(br)...
- 同程旅行王晓波:同程凤凰缓存系统在基于 Redis 方面的设计与实践(上篇)
- 设计模式之:深入浅出 java 单例模式(Singleton)
- 央视放出荣耀9X系列广告宣传片:麒麟810处理器+侧面指纹识别
- 炉石整活拔线方法_酒馆战棋:整活如何简单“拔线”?瓦娘在线教学,却3本得死神?...
- LeetCode刷题(40)--Search a 2D Matrix
- APS技术中的多目标规划问题
- paip.提升用户体验-----c++ 宏的使用...替换从在的地张儿复制过来的代码.
- kux2mp4(优酷kux转换为mp4软件) v2021
- excel各种填充的总结
- 【读书笔记】法治的细节——做我们觉得对的事情,然后接受它的事与愿违
- 自行車基本知識 (zz)
- Unity UGUI图文混排源码(二)
- MyCat教程【分库分表】
- 帮爷爷刻录VCD光盘
- P1423 小玉在游泳-C语言
- 关于全局鼠标钩子卡的原因分析