Google Chrome command line switch to emulate a device size?

丶灬走出姿态 提交于 2019-12-25 11:42:49

问题


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.


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/22572019/google-chrome-command-line-switch-to-emulate-a-device-size

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!