Python 3.x Selenium Python返回异常数据
我正在尝试从以下标签中提取hrefPython 3.x Selenium Python返回异常数据,python-3.x,selenium,web-scraping,beautifulsoup,Python 3.x,Selenium,Web Scraping,Beautifulsoup,我正在尝试从以下标签中提取href <a href="https://www.olx.ph/item/pioneer-pointe-condominium-unit-for-rent-1-br-fully-furnished-22k-ID8k7OP.html?h=ba76d6b70e&utm_source=Opt_Homepage_Var_1&utm_medium=Ad_Clicks&utm_campaign=Phase_2" itempro
<a href="https://www.olx.ph/item/pioneer-pointe-condominium-unit-for-rent-1-br-fully-furnished-22k-ID8k7OP.html?h=ba76d6b70e&utm_source=Opt_Homepage_Var_1&utm_medium=Ad_Clicks&utm_campaign=Phase_2" itemprop="url" class="funnel" data-category-id="137" data-funnel-type="Select Ad" data-action-type="Select Ad" data-funnel-userid="0">
<span class="title" itemprop="name">Pioneer Pointe Condominium unit for rent - 1 BR Fully Furnished - 22K</span>
</a>
我目前的异常输出是:
<selenium.webdriver.remote.webelement.WebElement (session="8b6a29a1af20221f48056d6a8f34bd63", element="0.8368598264582081-1")>
<selenium.webdriver.remote.webelement.WebElement (session="8b6a29a1af20221f48056d6a8f34bd63", element="0.8368598264582081-2")>
<selenium.webdriver.remote.webelement.WebElement (session="8b6a29a1af20221f48056d6a8f34bd63", element="0.8368598264582081-3")>
注意:这只是输出的一部分(前三行)
这些应该是标签的href只需返回浏览器找到的对象,您必须指定所需对象的哪一部分
for l in links:
print(l.get_attribute("href"))
for l in links:
print(l.get_attribute("href"))