How to set the device type (to not mobile) when inspecting a remote target with Chrome DevTools?
Asked Answered
O

2

6

So it seems that the device toolbar usually present in any regular DevTools instance is missing when inspecting a remote instance.

device toolbar

And in such cases the device type is set to "Mobile", with the mouse pointer set to a circle, as to indicate that.

Here's how to reproduce this:

  1. start a new headless instance, e.g., with:

    /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --headless https://example.com
    
  2. using another Chrome instance navigate to chrome://inspect and inspect the remote tab.

  3. as you can see there is no device toolbar.

devtools

I also tried to send some Chrome DevTools Protocol commands like:

But to no avail, something happens but the behavior looks broken... I suspect that this is something concerning the DevTools frontend, and not the inspected Chrome instance.

Do you have any idea about how can I work around this? My ultimate goal is to manually interact with a remote headless instance using a desktop device type.

Omidyar answered 24/4, 2022 at 14:35 Comment(1)
I replicated the problem. It looks like the remote debugging is intended for mobile devices (where dev tools are not available locally). It should work for headless too, but the remote dev tools doesn't want even open for headless for me. For not headless it opens.Ostensorium
O
0

Not sure since when, but in version 121.0.6167.139 a new switch appeared.

Touch vs mouse switch

Omidyar answered 7/2 at 22:40 Comment(0)
M
2

If I understand you correctly, you want to do manual interactions with a remote instance using a desktop device. You should just be able to click the device icon at the top left of your devtools window to turn off mobile.

DevTools Device Toggle

Mervinmerwin answered 17/5, 2022 at 18:43 Comment(6)
As you can see from the second screenshot there is no toolbar to do that.Omidyar
And clicking on that icon simply closes the page preview.Omidyar
I think this answer is probably correct. If your Chrome is not behaving, try installing the "Chromium Browser" and tell us if its the same behavior.Liripipe
Have you tried the scenario in the OP?Omidyar
Have you tried using Chrome Canary or Chromium? This seems like it may be a limitation of the standard Chrome browser on Mac.Mervinmerwin
I replicated the problem on Windows. I looks like you don't understand the questionOstensorium
O
0

Not sure since when, but in version 121.0.6167.139 a new switch appeared.

Touch vs mouse switch

Omidyar answered 7/2 at 22:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.