我试图在eBay上刮擦男表,但由于某种原因,什么都没打印。我非常肯定我具有正确的xpath位置。
try:
title_selenium = soup.find_element_by_xpath('//*[@id="itemTitle"]').text
except:
title_selenium = ""
try:
price_selenium = soup.find_element_by_xpath('//*[@id="prcIsum"]').text.strip().split()
except:
price_selenium = ""
try:
total_sold_price_BeautifulSoup = soup.find('span', {'class': 'vi-qtyS-hot-red'}).text
except:
total_sold_price_BeautifulSoup = ""
print("title: ", title_selenium)
print("price: ", price_selenium)
print("total_sold_price: ", total_sold_price_BeautifulSoup)
整个代码:https://pastebin.com/GWU0XmYp
非常感谢。认真地。