In the post “Follow up questions from Synthetics Webinar 10-27-15”, Shane Delight makes the following reference:
Q:Can you configure the webdriver to simulate running on a mobile device for responsive websites?
A: Yes, you can simulate it by setting the User agent to a mobile agent and the screen size to an appropriate resolution. This is still just chrome passing the user agent and screen size but it should display your responsive site.
Okay, the user agent part is easy:
$browser.addHeader(‘User-Agent’,‘Mozilla/5.0 (Linux; U; Android 2.3.3; Nexus S Build/GRI20) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1’);
But what about the screen resolution. It would seem the following command might work but it does not.
How do you influence/set the screen resolution in a script?