Launching Chrome with mobile emulation enabled from the command line

3,202 views
Skip to first unread message

Michael Hollander

unread,
Jan 23, 2019, 12:27:17 PM1/23/19
to Chrome DevTools
Hello,

I would like to know if it's possible to launch Chrome from the command line with mobile emulation enabled (normally done with F12 > Toggle device toolbar). I will be running some automated test cases and I'd like to emulate Chrome for Android so I don't need to deal with actually emulating Android devices, which will be a pain as multiple models of phones will need to be tested.

Paul Irish

unread,
Jan 23, 2019, 12:34:40 PM1/23/19
to Google Chrome Developer Tools
Typically whatever software is automating Chrome has an option for enabling emulation. eg you can do this in WebDriver/ChromeDriver and puppeteer.

On Wed, Jan 23, 2019, 12:27 PM Michael Hollander <hollan...@gmail.com wrote:
Hello,

I would like to know if it's possible to launch Chrome from the command line with mobile emulation enabled (normally done with F12 > Toggle device toolbar). I will be running some automated test cases and I'd like to emulate Chrome for Android so I don't need to deal with actually emulating Android devices, which will be a pain as multiple models of phones will need to be tested.

--
You received this message because you are subscribed to the Google Groups "Chrome DevTools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-chrome-developer-tools/93e1dca9-3276-4b87-875a-f951b2cbc532%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

PhistucK

unread,
Jan 23, 2019, 12:35:35 PM1/23/19
to Google Chrome Developer Tools
Assuming you re-use the user data dir, you can launch Chrome, enable device mode and then every time you launch Chrome with --auto-open-devtools-for-tabs, it will automatically launch the Developer Tools (and automatically enable device mode) and your tests will run in device mode.
(Unless you are using --headless, in which case, you might have to do something else using the debugging protocol.)

PhistucK


On Wed, Jan 23, 2019 at 7:27 PM Michael Hollander <hollan...@gmail.com> wrote:
Hello,

I would like to know if it's possible to launch Chrome from the command line with mobile emulation enabled (normally done with F12 > Toggle device toolbar). I will be running some automated test cases and I'd like to emulate Chrome for Android so I don't need to deal with actually emulating Android devices, which will be a pain as multiple models of phones will need to be tested.

--

goe...@umich.edu

unread,
Jan 23, 2019, 12:47:50 PM1/23/19
to Chrome DevTools
I was recently trying to do something similar. 
Hopefully this should answer your question: https://github.com/ChromeDevTools/devtools-protocol/issues/141
Reply all
Reply to author
Forward
0 new messages