cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Gaurav.Soni
AppDynamics Team (Retired)

Question

Can I emulate a mobile device like an iPhone, tablet or Android phone?

 

Environment 

Synthetic Agent >= v4.4 

 

Answer

Yes. The 4.4 Controller includes a dropdown in the Job Editor. Older Controllers can enable it through a backdoor:

 

Device Emulation

'''yml
deviceEmulationProfile:
  name: "iPhone7"
  description: "iPhone 7 - iOS - 375x667x2"
  userAgent: "Mozilla/5.0 (iPhone; CPU OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14A5297c Safari/602.1"
  width: 375
  height: 667
  pixelRatio: 2.0
  touch: true
'''
driver.get("http://www.mysite.com")

 

If you don't know by heart the pixel ratio of the Galaxy S8 or the user agent of an iPad, we have you covered. Here is a cheat sheet for you:

 

Device Emulation list

'''yml
deviceEmulationProfile:
  name: "iPhone7"
  description: "iPhone 7 - iOS - 375x667x2"
  userAgent: "Mozilla/5.0 (iPhone; CPU OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14A5297c Safari/602.1"
  width: 375
  height: 667
  pixelRatio: 2.0
  touch: true
'''
  
'''yml
deviceEmulationProfile:
  name: "iPhone7Plus"
  description: "iPhone 7 Plus - iOS - 414x736x3"
  userAgent: "Mozilla/5.0 (iPhone; CPU OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14D27 Safari/602.1"
  width: 414
  height: 736
  pixelRatio: 3.0
  touch: true
'''
  
'''yml
deviceEmulationProfile:
  name: "iPhoneSE"
  description: "iPhone SE - iOS - 320x568x2"
  userAgent: "Mozilla/5.0 (iPhone; CPU OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/10A525 Safari/602.1"
  width: 320
  height: 568
  pixelRatio: 2.0
  touch: true
'''
  
'''yml
deviceEmulationProfile:
  name: "iPad3"
  description: "iPad - iOS - 1024x768x2"
  userAgent: "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/10A523 Safari/602.1"
  width: 1024
  height: 768
  pixelRatio: 2.0
  touch: true
'''
   
'''yml
deviceEmulationProfile:
  name: "Pixel"
  description: "Pixel - Android - 411x731x2.6"
  userAgent: "Mozilla/5.0 (Linux; Android 7.1.2; Pixel Build/N2G47O) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.3029.83 Mobile Safari/537.36"
  width: 411
  height: 731
  pixelRatio: 2.63
  touch: true
'''
  
'''yml
deviceEmulationProfile:
  name: "PixelXL"
  description: "Pixel XL - Android - 411x731x3.5"
  userAgent: "Mozilla/5.0 (Linux; Android 7.1.2; Pixel XL Build/N2G47O) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.3029.83 Mobile Safari/537.36"
  width: 411
  height: 731
  pixelRatio: 3.5
  touch: true
'''
   
'''yml
deviceEmulationProfile:
  name: "PixelC"
  description: "Pixel C - Android - 1280x900x3.5"
  userAgent: "Mozilla/5.0 (Linux; Android 7.0; Pixel C Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/52.0.2743.98 Safari/537.36"
  width: 1280
  height: 900
  pixelRatio: 2.0
  touch: true
'''
  
'''yml
deviceEmulationProfile:
  name: "GalaxyS8"
  description: "Galaxy S8 - Android - 360x740x4.0"
  userAgent: "Mozilla/5.0 (Linux; Android 7.0; SAMSUNG SM-G950F Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/5.2 Chrome/51.0.2704.106 Mobile Safari/537.36"
  width: 360
  height: 740
  pixelRatio: 4.0
  touch: true
'''
   
'''yml
deviceEmulationProfile:
  name: "HiDPI"
  description: "HiDPI laptop - Windows - 1024x768x2.0"
  width: 1024
  height: 768
  pixelRatio: 2.0
  touch: false
'''
Version history
Last update:
‎09-07-2018 09:32 AM
Updated by: