Simulate mobile device with selenium
Now that mobile technologies becomes so popular most of the traffic that businesses receives comes from mobile. Your team might not have a setup to run the tests using appium in house or using some third part service provider. There is a solution that you can rely on , to simulate mobile device with selenium using chrome browser.
I know there might be voices saying that you might miss important bugs , I would say not really because:
User Agent Recognition
One important concept in the mobile world is the so called User Agent of a device. The detection of a mobile device can be done on the client-side (browser) and/or the server-side, and these approaches have certain major differences.
When you want to see how a site would look on a certain mobile phone model without using the actual device, your best bet for accurate results is to mimic the User Agent string (UA) of the device. What happens when you download a web page is your browser sends its UA to the server.
- It’s an emulator, so you don’t need any real phones for testing.
- Customizable User Agents – Users can freely change the UA string.
- Super simple to instantiate and easy to use. No need to install any complex SDKs or the like.
- no special infrastructure required to run the tests , can use the desktop one
- Media support may not be perfect.
- By default, only User Agent Strings for the platforms Chrome runs on are included. However, it’s possible to add iPhone User Agent to Chrome Mobile Emulator as a custom UA string.
- The emulator displays how pages look using the mobile browser — as known, not all features work similarly in different browsers. Even more so in the mobile world.