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.
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.
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