selenium-wire icon indicating copy to clipboard operation
selenium-wire copied to clipboard

抓取不到请求头

Open ParaWin opened this issue 2 years ago • 1 comments

from seleniumwire import webdriver

#capabilities = DesiredCapabilities.CHROME #capabilities['loggingPrefs'] = {'browser': 'ALL'} chrome_options = webdriver.ChromeOptions() #chrome_options.add_argument('--headless') chrome_options.add_experimental_option('useAutomationExtension',False) chrome_options.add_experimental_option("excludeSwitches",['enable-automation']) chrome_options.add_argument('--no-sandbox') chrome_options.add_argument('--ignore-certificate-errors-spki-list') chrome_options.add_argument('--ignore-ssl-errors')

chrome_options.add_experimental_option("debuggerAddress","127.0.0.1:9222")

driver = webdriver.Chrome( options=chrome_options) driver.get('https://www.baidu.com')

for request in driver.requests: if request.response: print(request.path)

ParaWin avatar Jun 24 '22 12:06 ParaWin

The right field should be used in this case is headers -print(request.path) +print(request.response.headers)

shane-zhang avatar Aug 22 '22 20:08 shane-zhang