Automated Tester

.science

This content shows Simple View

Webdriver

Mobile Emulation with ChromeDriver

We can use ChromeDriver to run automated Selenium tests against a whole stack of different devices with Chrome Dev Tools Mobile Emulation option.

Devices currently supported at the time of writing:

  • Amazon Kindle Fire HDX
  • Apple iPad
  • Apple iPad Mini
  • Apple iPhone 4, 5, 6 & 6+
  • Blackberry Playbook
  • Blackberry Z30
  • Google Nexus 4, 5, 6, 7 & 10
  • LG Optimus L70
  • Laptop with HiDPL Screen
  • Laptop with MDPI Screen
  • Laptop with touch
  • Nokia Lumia 520
  • Nokia N9
  • Samsung Galaxy Note 3
  • Samsung Galaxy Note II
  • Samsung Galaxy Note S III
  • Samsung Galaxy S4
Discovering the options available

ChromeDriver Mobile Emulation

Now it’s just a case of passing the device string to ChromeOptions’ EnableMobileEmulation option when instantiating the driver, like so:

public static void SetupIPadDriver()
{
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.EnableMobileEmulation("Apple iPad");
Driver = new ChromeDriver(chromeOptions);
}

Kick your test off and see it running in chrome but to the specification you supplied in the ChromeDriver option. There are of course subtle differences between emulators and real devices, weigh up the pros and cons for yourself and have a look at the official documentation.



Welcome to Automated Tester.science

What’s all this then?

Automated Tester is a site for community and professionals to talk about and help each other in all things automated in the testing world. I will try to post snippets of what I know but the main intention is to drive use of the forums, comments and such like.

Who are you?

My name is Justin Holsgrove, I am a test automation engineer/ dev in test using C# .Net to develop testing solutions with Selenium Webdriver. Primarily in a BDD sense.

What’s with the .science suffix?

Well the reason is two-fold, firstly you could maybe  argue that testing is a science in itself, certainly in computing terms. Secondly, a domain name provider was giving the .science TLD away for free.

Please feel free to contribute to this site in any way you see fit that will benefit others in what they do. That may include guest posts, forumming, book plugging, whatever you like, it is your contributions that matter!




top