Closed eqMFqfFd closed 3 years ago
It is worth noting that using the undetected-chromedriver module, the browser name successfully updates (but not to the custom browser set).
Without also deviating from the central topic, what about these red indicators using the module? Will this affect tests in other bot-protected sites?
Thanks for raising this.
This is possibly happening because you're assigning a dictionary to request.headers
and overwriting the dictionary-like object that holds the existing headers.
To replace an existing header such as the user-agent, you'll need to remove it first and then add it:
def request_interceptor(request) :
del request.headers["User-Agent"]
request.headers["User-Agent"] = custom_headers["User-Agent"]
Thank you.
Issue description
It strikes me that when I add custom headers to Chrome browser using wkeeling/selenium-wire, the headers sometimes apply and sometimes do not.
Code to reproduce
Tests
Local test
https://bit.ly/3da3X1S
Chrome automation test
https://bit.ly/3mIbS9H