kaliiiiiiiiii / Selenium-Profiles

undetected Selenium using chromedriver and emulation / device profiles
Other
290 stars 28 forks source link

User-agent not working #108

Closed henzycuong1 closed 1 year ago

henzycuong1 commented 1 year ago

The code:

from selenium_profiles.webdriver import Chrome
from selenium_profiles.profiles import profiles
from selenium_driverless.webdriver import ChromeOptions
from selenium_driverless.types.by import By
INFO = {
    "options": {
      "gpu": False,
    },
    "cdp": {
      "touch": True,
      "maxtouchpoints": 10,
      "cores": 8,
      "patch_version": True,
      "emulation": {"mobile":False,"width": 1366, "height": 768, "deviceScaleFactor": 1,
        "screenOrientation": {"type": "landscapePrimary", "angle": 0}},
      "useragent": {
                "platform": "Win32",
                "acceptLanguage":"en-US",
                "userAgent": "Mozilla/5.0 (Windows NT 5.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.1.7064.63 Safari/537.36",
                "userAgentMetadata": {
                    "brands": [{"brand":"Google Chrome","version":"116"},
                              {"brand":"Chromium","version":"116"},
                              {"brand":"Not=A?Brand","version":"24"}],
                    "fullVersionList": [{"brand":"Google Chrome","version":"116.1.7064.63"},
                                        {"brand":"Chromium","version":"116.1.7064.63"},
                                        {"brand":"Not=A?Brand","version":"24.0.0.0"}],
                    "fullVersion": "116.1.7064.63",
                    "platform": "Windows",
                    "platformVersion": "5.0.0",
                    "architecture": "x86",
                    "model": "",
                    "mobile": False,
                    "bitness": "64",
                    "wow64": False}
      }

    }
  }

options = ChromeOptions()
driver = Chrome(INFO, options=options, driverless_options=True)
driver.get('https://abrahamjuliot.github.io/creepjs/') 
input("WAIT")
driver.quit()

Test: image image

And can you add a feature can change "UNMASKED_VENDOR_WEBGL" and "UNMASKED_RENDERER_WEBGL" on browser. Thank you so much

kaliiiiiiiiii commented 1 year ago

@henzycuong1 Thanks for opening this issue! You provided the useragent Mozilla/5.0 (Windows NT 5.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.1.7064.63 Safari/537.36 to be set, and the only thing different is Chrome/version. That's expected.

You can set "patch_version":False if you really need that exact version.

Also, changing UNMASKED_VENDOR_WEBGL would verry likely make you detected. Therefore closing for now