【发布时间】:2021-08-05 04:30:03
【问题描述】:
我正在使用此 python 脚本返回 html,但它不返回价格历史记录(见屏幕截图)。使用非硒浏览器确实会返回带有价格的 html(即使没有通过简单的正则表达式扩展本节); chrome/safari/firefox 都可以,隐身也可以。
from selenium import webdriver
import time
url = 'https://www.google.com/flights?hl=en#flt=SFO.JFK.2021-06-01*JFK.SFO.2021-06-07'
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(options=options)
driver.get(url)
time.sleep(10)
html = driver.page_source
print(html)
driver.quit()
我无法确定它是否是 chromedriver 中的某些设置。之所以可以这样做,是因为目前有一个 3rd 方抓取工具返回此数据。
试过这个没有用。 Can a website detect when you are using Selenium with chromedriver?
任何想法表示赞赏。
【问题讨论】:
标签: python selenium google-chrome selenium-chromedriver selenium-firefoxdriver