selenium-wire
selenium-wire copied to clipboard
Add possibility to pass your own MitmProxy (backend) to webdriver
Why to implement the feature: When you want to connect to a running browser instance, you need to run the browser giving him the proxy params. Some browsers (like Dolphin) will fail to run the instance if they can't ping the proxy, so the proxy should be already running before running the browser. I am starting an instance of Dolphin in my code, so basically I needed to create proxy first, than start Dolphin and only after that create a webdriver that will connect to Dolphin.
Many thanks for raising the PR.
I had a question regarding:
so the proxy should be already running before running the browser
Selenium Wire by default does start the proxy first, which is what the self._setup_backend()
call does in the webdriver initializer (it's the final super().__init__()
call that starts the browser instance).
Which webdriver type do you use for connecting to Dolphin? Wondering if we need a new webdriver.Dolphin
class creating?
Yes, I understand that it does start the proxy first. But I can't do anything between proxy starting and initializing webdriver, so it doesn't help (in my case webdriver doesn't start the browser instance, it connects to a started instance). I use Chrome webdriver.
Anything new in this case?