botasaurus icon indicating copy to clipboard operation
botasaurus copied to clipboard

Access to MobileEmulation features of Chrome Webdrivers

Open jkersch opened this issue 1 year ago • 0 comments

Hi,

is there a way to modify the MobileEmulation features of chrome? (at least i have not find a simple way to access the underlying chromedriver from the source code) or at least expose access to an underlying chromium/chrome instance?

with selenium you could set something like

mobile_emulation = { "deviceMetrics": { "width": 360, "height": 640, "pixelRatio": 3.0 }, "userAgent": "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19", "clientHints": {"platform": "Android", "mobile": True} } chrome_options = Options() chrome_options.add_experimental_option("mobileEmulation", mobile_emulation) driver = webdriver.Chrome(chrome_options = chrome_options)

to set mobile device specifics like DeviceMetrics or Client Hints. That way also DPI specifics (not just resolution) could be set to emulate mobile clients, which would be relevant in my use case. I would like to use botasaurus but see no way to set these specifics to the actual browser engines.

thanks j.

jkersch avatar Oct 13 '24 06:10 jkersch