Google Chrome command line switch to emulate a dev

2019-08-31 08:17发布

Does anyone know what are the Google Chrome command line switches that I can use to emulate the device size?

The component that I want to test contains the CSS @media query min-device-width/min-device-height. I tried using the --window-size and --user-agent but I have no luck with those.

Basically, I am trying to write a webdriver test for this component.

2条回答
倾城 Initia
2楼-- · 2019-08-31 09:00

There are switches which might help you do that --window-size, --user-agent and --use-mobile-user-agent .Here is the full list of switches. This article also explains how to save those settings as a new app.

I was also looking for a way to trigger chrome mobile emulation tool by command line or using webdriver or simply karma, but according to this answer and chromium team there is no such option yet, but a feature request has been filled up you can vote for.

查看更多
手持菜刀,她持情操
3楼-- · 2019-08-31 09:03

Regular Chrome does not really support this function, but Chrome Canary is exactly what you are looking for.

https://www.google.com/intl/en/chrome/browser/canary.html

https://developers.google.com/chrome-developer-tools/docs/mobile-emulation

查看更多
登录 后发表回答