how to fetch a request sent by a selenium automated browser ?

palanore1

Registered Member
Joined
Feb 12, 2024
Messages
71
Reaction score
25
Hello!
I am trying to read the headers from a request sent trough a selenium controlled browser instance. To be more precise, I want to inspect the sent package like I would do manually from the Chrome DevTools Network tab, where u can inspect each request sent by that browser.

Is there any way I can automate that, so I can read the headers of a request and than use that information with my script further ?

thanks in advance !
 
this isn't possible with regular selenium
you need to use selenium-wire
https://pypi.org/project/selenium-wire/


Even tho I use this code:

options = {
"addr": "127.0.0.1",
}
driver = webdriver.Remote(
command_executor=f"http://127.0.0.1:{selenium_port}",
seleniumwire_options=options,
)


I get this error somehow:
TypeError: WebDriver.__init__() got an unexpected keyword argument 'desired_capabilities'

Any idea whats going one there ?
 
post your whole code and the entire stack trace
 
Back
Top