【发布时间】:2015-12-17 13:53:21
【问题描述】:
我正在尝试使用以下内容在给定页面上查找网址:
driver.find_element_by_css_selector('.listing-title a').get_attribute('href')
这足以抓取第一个网址。但是,我不知道如何获取页面上的其他 href 属性。我尝试将s 添加到element:
driver.find_elements_by_css_selector('.listing-title a').get_attribute('href')
但我收到以下错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'list' object has no attribute 'get_attribute'
有什么建议吗?
【问题讨论】:
标签: python selenium getattribute