wkeeling / selenium-wire

Extends Selenium's Python bindings to give you the ability to inspect requests made by the browser.
MIT License
1.86k stars 240 forks source link

Requests not being captured #702

Open awilz10xp opened 10 months ago

awilz10xp commented 10 months ago

Doing the most basic operations with selenium-wire and the requests array always lists as empty. I'm guessing there's an unsupported library installed but not sure how to ensure compatibility

VS Code 1.81.1 chromedriver 115.0.5790.170 python 3.10.11 selenium 4.11.2 selenium-wire 5.1.0

test.py ------

from seleniumwire import webdriver

driver = webdriver.Chrome()

driver.get('https://www.google.com/')

for request in driver.requests: if request.response: print( request.url, request.response.status_code, request.response.headers['Content-Type'] )

Chrome opens and navigates to google then closes

awilz10xp commented 10 months ago

I slightly modified it with the same results ... added the console output. Any advice would be greatly appreciated.

if True: driver.get("https://www.google.com/") time.sleep(5) print(driver.requests) driver.quit()

DevTools listening on ws://127.0.0.1:56700/devtools/browser/95763f06-399c-4055-ab0b-324666c91e1a []

PatrickAlliander commented 10 months ago

I've never used it like that. I always used the interceptor functionality as described here. Did your request to google actually finish?

My current code base is a bit dated due to temporary shifted priorities (it will shift back to add selenium-wire intercept chrome stuff soon).