编写下面的代码:

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相关推荐

  1. Python报错TypeError: ‘User‘ object is not iterable

    Python报错TypeError: 'User' object is not iterable 原因 User对象是不可迭代的,我这里是因为User并不是list,所以是不可迭代的,所以不使用迭代即 ...

  2. python常见错误 TypeError: 'NoneType' object is not iterable

    TypeError: 'NoneType' object is not iterable 1. 将None赋给多个值时,会出现提示:TypeError: 'NoneType' object is no ...

  3. Python+selenium自动化测试:报错:TypeError: 'WebElement' object is not iterable

    代码: # -*- coding: utf-8 -*-from selenium import webdriverfrom selenium.webdriver.common.by import By ...

  4. python nonetype_【已解决】Python程序错误:TypeError: ‘NoneType’ object is not iterable

    [问题] 如下代码:def callBlogFunc(funcToCall, *paraList): funcName = funcToCall.func_name; if(blogIsNetease ...

  5. 个人报错TypeError: ‘type‘ object is not iterable

    django报错 'type' object is not iterable,个人报错原因解析 E:\django_project\my_blog\article\models.py changed, ...

  6. 生成浮点数列表:Python range():TypeError: ‘float‘ object cannot be interpreted as an integer

    生成浮点数列表:Python range():TypeError: 'float' object cannot be interpreted as an integer 目录 Python range ...

  7. 成功解决TypeError int object is not iterable

    成功解决TypeError: 'int' object is not iterable 目录 解决问题 解决思路 解决方法 解决问题 TypeError: 'int' object is not it ...

  8. TypeError: 'float' object is not iterable

    求心率的peason相关系数的时候遇到这个问题: TypeError: 'float' object is not iterable 解决方法: pre_label.extend(output) ty ...

  9. python 多进程multiprocessing进程池pool tensorflow-yolov3 报错TypeError: 'ApplyResult' object is not iterable

    首先,代码结构它长这样: 可每次调用线程池进行识别时,就会报如下错误: D:\20191031_tensorflow_yolov3\python\python.exe D:/20191031_tens ...

最新文章

  1. 年入50万,程序员众生相
  2. Science:便携式DNA测序仪在检测病毒疫情中大显身手
  3. 计算机弹出错误字,电脑蓝屏,并且屏幕上出现这样的文字该怎么解决?
  4. php代码文字中怎么换行符,如何在imagestring(php中的文本到图像)中添加换行符(br)...
  5. 同程旅行王晓波:同程凤凰缓存系统在基于 Redis 方面的设计与实践(上篇)
  6. 设计模式之:深入浅出 java 单例模式(Singleton)
  7. 央视放出荣耀9X系列广告宣传片:麒麟810处理器+侧面指纹识别
  8. 炉石整活拔线方法_酒馆战棋:整活如何简单“拔线”?瓦娘在线教学,却3本得死神?...
  9. LeetCode刷题(40)--Search a 2D Matrix
  10. APS技术中的多目标规划问题
  11. paip.提升用户体验-----c++ 宏的使用...替换从在的地张儿复制过来的代码.
  12. kux2mp4(优酷kux转换为mp4软件) v2021
  13. excel各种填充的总结
  14. 【读书笔记】法治的细节——做我们觉得对的事情,然后接受它的事与愿违
  15. 自行車基本知識 (zz)
  16. Unity UGUI图文混排源码(二)
  17. MyCat教程【分库分表】
  18. 帮爷爷刻录VCD光盘
  19. P1423 小玉在游泳-C语言
  20. 关于全局鼠标钩子卡的原因分析

热门文章

  1. [转]Nginx的负载均衡方式
  2. NodeJS React 开发环境搭建
  3. 【bzoj】 1412: [ZJOI2009]狼和羊的故事
  4. ionic简单路由及页面传参
  5. abctod_123456
  6. uoj #118. 【UR #8】赴京赶考 水题
  7. 表示探索、探究的几个词
  8. 美国影视演员协会选择了Windows Azure
  9. xstream,节点属性起别名时这样的问题你遇到过吗
  10. GoCD notes