How to set the device type to desktop (no touch) when connecting to a remote instance via WebSocket?

9 views
Skip to first unread message

Andrea Cardaci

unread,
Apr 26, 2022, 3:39:25 AMApr 26
to Chrome DevTools
Hi there,

I'm in a situation where I need to use DevTools to interact with a remote headless Chrome instance. The workflow is the following:
  1. spawn the headless instance and do some preliminary setup (chrome-launcher + chrome-remote-interface);
  2. from another instance, navigate to chrome://inspect and inspect the tab;
  3. a window pops up where, on the left-hand side there is the screencast, and on the right-hand side there is DevTools.
The problem is that Chrome is treating the remote instance as a mobile device, in particular it show the circle pointer, and the website I need to interact with (a Guacamole RDP session) doesn't work properly on mobile as it relies heavily on mouse events. The question is, how can I use it as desktop device? The usual DevTools toolbar with the dropdown menu containing Desktop, Mobile, etc. is not present in this setup.

I even tried executing some CDP methods like Emulation.setTouchEmulationEnabled and Emulation.setDeviceMetricsOverride, but with no luck, something happens but the behaviour looks broken... I suspect that this is something concerning the DevTools frontend, and not the inspected Chrome instance.

In other words, how can I set the device type to be "Desktop" (instead of "Mobile") in devtools://devtools/bundled/inspector.html?ws=[...]? There is no device toolbar there.

Do you have any idea about how can I achieve this?


Best,
Andrea


PS I originally posted this message in the chrome-debugging-protocol group, and I'm reposting here for visibility. I apologise for that, but I'm really stuck here...

PPS Same thing asked on StackOverflow.
Reply all
Reply to author
Forward
0 new messages