Page 1 of 1

Obtain mobile device name and os

Posted: Thu Mar 05, 2015 4:29 pm
by lstauffer
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!

Re: Obtain mobile device name and os

Posted: Fri Mar 06, 2015 9:45 am
by Support Team
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)

Re: Obtain mobile device name and os

Posted: Fri Mar 06, 2015 2:13 pm
by lstauffer
Thank you!! That worked beautifully!

Re: Obtain mobile device name and os

Posted: Tue May 19, 2015 7:22 am
by aravin
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)

Re: Obtain mobile device name and os

Posted: Thu May 21, 2015 1:02 pm
by Support Team
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
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)