ultrafunkamsterdam / undetected-chromedriver

Custom Selenium Chromedriver | Zero-Config | Passes ALL bot mitigation systems (like Distil / Imperva/ Datadadome / CloudFlare IUAM)
https://github.com/UltrafunkAmsterdam/undetected-chromedriver
GNU General Public License v3.0
9.62k stars 1.15k forks source link

Is mobileEmulation supported ? #491

Open anhtuancta opened 2 years ago

anhtuancta commented 2 years ago
chrome_options = uc.ChromeOptions()
mobile_emulation = {"deviceName": "iPhone 7 Plus"}
chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)
self.driver = uc.Chrome(options=chrome_options)

I got this error: File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: cannot parse capability: goog:chromeOptions from invalid argument: unrecognized chrome option: mobileEmulation

Snuifstuif commented 2 years ago

try chrome_options.add_expirimental_option

sebdelsol commented 2 years ago

Please check here.

kaliiiiiiiiii commented 1 year ago

you can use Selenium_Profiles still in progress//working on btw

desis123 commented 1 year ago

Following code works for me

 set_device_metrics_override = dict({
              "width": 375,
              "height": 812,
              "deviceScaleFactor": 50,
              "mobile": True
          })
 browser = uc.Chrome(options=options) 
 browser.execute_cdp_cmd('Emulation.setDeviceMetricsOverride', set_device_metrics_override)   
gelodefaultbrain commented 1 month ago

Following code works for me

 set_device_metrics_override = dict({
              "width": 375,
              "height": 812,
              "deviceScaleFactor": 50,
              "mobile": True
          })
 browser = uc.Chrome(options=options) 
 browser.execute_cdp_cmd('Emulation.setDeviceMetricsOverride', set_device_metrics_override)   

Wow it works! amazing legend!