I am using Selenium with Python and attempting to trick the browser (chrome) into thinking I'm on a Windows machine when I'm actually running Linux.

So far, I have managed to modify the User-Agent to mimic a Windows system:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

I have also used the following line to change navigator.platform: driver.execute_cdp_cmd('Page.addScriptToEvaluateOnNewDocument', {'source': "Object.defineProperty(navigator, 'platform', {get: () =\> 'Win32'})"})

However, these modifications appear to be insufficient. I've learned that the browser can also detect the platform through WorkerNavigator.platform, but I'm unsure of how to modify this.

Are there other attributes that I should consider changing to successfully emulate a Windows environment in the browser using Selenium? Any insights or guidance would be much appreciated.

  • Why do you need to do this? That would help us to help you.
    – Kate Paulk
    Commented Jun 16, 2023 at 12:15
  • Did you have solved to this issue? I have same issue and long time research did not give results =(
    – blacksan
    Commented Oct 23, 2023 at 13:39
  • Unfortunately, no. A possible solution is to modify the Chromium code and compile it into our own browser. However, I don't have the necessary skills to do that. :(
    – Zefnes
    Commented Oct 25, 2023 at 11:18


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.