Closed javo222 closed 4 years ago
i have the same problem but i´m using Chrome
@javo222 thanks for this.
Selenium Wire works by transparently configuring the browser to point at Selenium Wire's own proxy server. That proxy server (running on 127.0.0.1:49818 in your example above) is used to capture requests made by the browser whilst Selenium Wire is running. After Selenium Wire ends, it shuts down its proxy server because it thinks it's done. However, if the browser is left open (which seems to be the case in your example above), the browser will still be pointing at the proxy server. Trying to use the browser will not work, because the proxy server has now gone away with the shutdown of Selenium Wire.
If you wish to manually interact with the browser, you'll need to keep Selenium Wire running by ensuring that your program does not end. You could potentially use a time.sleep()
for that, or perhaps some other mechanism such as input()
.
It works fine thank you!
I added this line in the end:
value = input("SCRIPT ENDED\n")
I'm sorry if I missed this in the documentation, or maybe it isn't there?
I met the same issue once open the page instead of selenium wire ends. Any suggestions?
'input("SCRIPT END")'works for me, thanks a lot! Both selenium-wire and undetected_chromedriver, this way works well.
I've made a small sample code which shows that the proxy server (no proxy!) does not allow Selenium-wire to catch traffic when navigating to a new page.
The first page is loaded correctly but after hitting ENTER, Firefox complains: The proxy server is refusing connections Firefox is configured to use a proxy server that is refusing connections.
I'm on a simple home network with no proxy configured in Firefox. When checking Firefox settings at the end of the script, I noticed the proxy settings are set to Manual.
Using Selenium instead of Selenium-wire and removing the driver.requests bit fixes the issue but prevents me from catching the XHR responses...
Edit: I've found some similar topics/issues on this page but none of them seems to be the exact same. I'm using selenium-wire-2.0.0
Here are the Debug logs: