selenium-wire
selenium-wire copied to clipboard
Clear driver.requests list after visiting a webpage
Hello,
First of all kudos for this great library. This is not a true issue rather than a question.
I was wondering if there was the possibility of clearing the requests
attribute of the webdriver
before visiting a new page, as I would like to avoid stopping and restarting a new driver for each web page.
Have you tried del driver.requests
? E.g
driver.get(...) # visit a page
del driver.requests # clear requests
driver.get(...) # visit a new page
Thanks @wkeeling, that was not my issue but I needed that information as well. That is working very well and. 🙏🏼
Ps. Thanks for great library. 💯
Hi, I would request / recommend adding a way for this del driver.requests
call to be atomic, e.g. in this example:
driver.get(...) # visit a page
del driver.requests # clear requests
driver.get(...) # visit a new page
It seems to be possible that driver.requests still gets populated by the first page after the del driver.requests
call.
Ideally, we could be guaranteed that the second driver.get
call would start with an empty driver.requests
, so we could know exactly which requests were associated with that page.