wkeeling / selenium-wire

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

Persistent Connections #308

Closed paulcalabro closed 3 years ago

paulcalabro commented 3 years ago

It looks like the setting for persistent connections used to exist but may no longer exist. Can someone please confirm if this is no longer possible? If no, are there any workarounds?

wkeeling commented 3 years ago

Yes the connection keep alive was retired when the underlying proxy implementation was switched to mitmproxy. Mitmproxy takes care of connection handling itself. Are you needing it for a specific reason?

paulcalabro commented 3 years ago

Thanks for the quick response! Yeah, I'm looking to leverage it because a device I'm working with has logic based on whether a request is the very first request after a connection is established. There's different logic to handle subsequent requests within the same connection, so I need to reuse the same connection to get the desired outcome.

wkeeling commented 3 years ago

It may be worth trying version 3.0.6 of Selenium Wire in that case, which was the last version that allowed control over the connection keep-alive. As mentioned, the current version doesn't allow manually changing the connection properties as that's handled automatically.