【发布时间】:2019-12-06 13:25:09
【问题描述】:
我正在从网络上抓取一些信息,但是在我使用 Selenium 和请求时得到了不同的结果
硒
driver.get('https://www.jobplanet.co.kr/companies/322493/benefits/%EC%A7%80%EC%97%90%EC%9D%B4%EC%B9%98%EC%94%A8%EC%A7%80')
soup= BeautifulSoup(driver.page_source, 'html.parser')
sample= soup.find_all('div', class_='accord_hd')`
请求
response= requests.get('https://www.jobplanet.co.kr/companies/322493/benefits/%EC%A7%80%EC%97%90%EC%9D%B4%EC%B9%98%EC%94%A8%EC%A7%80')
soup= BeautifulSoup(response.content, 'html.parser')
sample= soup.find_all('div', class_='accord_hd')`
在使用 Selenium 时,它返回一个空列表。 但在请求中,有一个包含一些字符串的列表。
我以前经历过类似的事情,所以我想知道这里发生了什么
【问题讨论】:
-
@Axois Selenium 是一个在后台运行的无头浏览器。而且 Selenium 在底线也是使用 http 请求。
标签: python selenium beautifulsoup python-requests web-crawler