Obtain mobile device name and os

Mobile Testing, Android App Testing.
lstauffer
Posts: 9
Joined: Fri Jan 23, 2015 2:31 pm

Obtain mobile device name and os

Post by lstauffer » Thu Mar 05, 2015 4:29 pm

Is it possible to get the device name and OS from the mobile phone being tested? I've tried to find this information, but was unsuccessful.

What I'd like to do is query the phone under test what type of phone it is . . Android or iOS. Depending on what the phone OS is depends on what user code I call.

Thanks in advance for any help you can provide!

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Obtain mobile device name and os

Post by Support Team » Fri Mar 06, 2015 9:45 am

Hi lstauffer,

In order to get the device name and the OS version of your mobile device you can use the following lines of code:
var devName = repo.RootElement.Self.DeviceName;
var OSVers = repo.RootElement.Self.OSVersion;
Whereby RootElement is:
Mobile_App.png
Mobile_App.png (1.95 KiB) Viewed 1183 times

Regards,
Markus (S)
.
Image

lstauffer
Posts: 9
Joined: Fri Jan 23, 2015 2:31 pm

Re: Obtain mobile device name and os

Post by lstauffer » Fri Mar 06, 2015 2:13 pm

Thank you!! That worked beautifully!

aravin
Posts: 47
Joined: Mon Mar 09, 2015 7:43 am

Re: Obtain mobile device name and os

Post by aravin » Tue May 19, 2015 7:22 am

Hi Markus,

I need to get exact device name which is provided my manufacturer.

Example: ipad2, ipad3, LG nexus, samsung note 3.

Do you have any suggestion?
Support Team wrote:Hi lstauffer,

In order to get the device name and the OS version of your mobile device you can use the following lines of code:
var devName = repo.RootElement.Self.DeviceName;
var OSVers = repo.RootElement.Self.OSVersion;
Whereby RootElement is:
Mobile_App.png

Regards,
Markus (S)

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Obtain mobile device name and os

Post by Support Team » Thu May 21, 2015 1:02 pm

Hi Aravin,

The following code allows you to get the information from your device:
var app = repo.iOSApp.Self.As<IosApp>();  
var info = app.GetDeviceInfo();
The info variable now contains the information which is shown in the screenshot below
ios_Deviceinfo.png
ios_Deviceinfo.png (20 KiB) Viewed 1089 times
I assume that 'DeviceSpecifier' is the property you are looking for.

Please find more information about non-ui testing in the following chapters of our User Guide
iOS
Android

Regards,
Markus (S)
.
Image