【发布时间】:2020-06-21 16:39:44
【问题描述】:
我正在尝试从this page 获取价格列表。
我要获取的元素的类名称为s-item__price。 这是我的代码:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
url = 'https://www.ebay.de/sch/i.html?_from=R40&_nkw=iphone+8+&_sacat=0&LH_TitleDesc=0&LH_ItemCondition=3000&rt=nc&LH_Sold=1&LH_Complete=1'
chrome_options = Options()
chrome_options.add_argument('--headless')
browser = webdriver.Chrome(options=chrome_options)
browser.get(url)
print(browser.find_elements_by_class_name('s-item__price'))
browser.quit()
输出只是一个空列表。
【问题讨论】:
标签: python selenium selenium-webdriver web-scraping