python – Selenium’WebElement’对象没有属性’Get_Attribute’
发布时间:2020-11-18 02:30:36 所属栏目:Python 来源:互联网
导读:我正在使用Selenium webdriver(chrome)和 Python,试图从页面上的所有链接获取href.当我尝试以下内容时: items = driver.find_elements_by_tag_name(a)print itemsfor item in items: href = item.Get_Attribute(href) print href
我正在使用Selenium webdriver(chrome)和 Python,试图从页面上的所有链接获取href.当我尝试以下内容时: items = driver.find_elements_by_tag_name("a") print items for item in items: href = item.Get_Attribute('href') print href 它设法获取所有链接,但在get_attribute上我收到一个错误: ‘WebElement’对象没有属性’Get_Attribute’ 虽然我看到的任何地方似乎都应该有效. 有解决方案吗 谢谢! 解决方法“Get_Attribute”属性不存在,但“get_attribute”属性执行:items = driver.find_elements_by_tag_name("a") print items for item in items: href = item.get_attribute('href') print href (编辑:甘南站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- python – Django和Node – 它是如何工作的?
- 为什么我的Python模拟补丁以错误的顺序出现?
- `with canvas:`(Python`with something()as x:`)如何隐式
- 在没有busywait的情况下在python中实现亚毫秒处理
- ImportError:没有模块名称’matplotlib’Python 3.3
- python – 管理站点中的默认过滤器
- python unicode rendering:如何知道字体中是否缺少unicode
- python – 当content-type为“application / xml”时,如何使
- python – 填充OpenCV轮廓的外部
- python – 根据列名拆分pandas数据框