Ashwin Pajankar
Ashwin Pajankar

Reputation: 115

DesiredCapabilities for Appium AndroidDriver

I am a Programmer with fair amount of exposure in automation. Currently I am working on Appium. I have gone through documentation of Appium and able to run the test cases on the Android Virtual Device, Physical Device and GenyMotion. However I am still not in clear about following desired capabilities.

1) UDID

It stands for Unique Device Identifier for the physical devices we connect. I have two questions for this. (a) Is it the same identifier when we connect a physical device and run "adb devices"? (b) Can we use this for Emulator/Simulator or an AVD? I have seen many code snippets over internet which use it for emulators like below.

capabilities.setCapability("udid", "emulator-5554");

2) deviceName

(a) How to find Device name? (b) Is there any command line tool which returns the names of all the connected devices? (c) Is UDID and Device name same? or these are two entirely different things? (d) Can there be a device name for a virtual device?

I have seen the snippets of code which use the value for deviceName same as UDID for an emulator.

capabilities.setCapability("udid", "emulator-5554");
capabilities.setCapability("deviceName", "emulator-5554");

Also I have seen many snippets of code online which use values like "Android Emulator", "Emulator" and "Android" and also "Nexus".

3) avd

(a) Do we have to pass the name that we set for our virtual device as a value to this parameter? (b) If we use this, do we have to use device or udid?

4) deviceType and device

These two capabilities are not listed in the Appium documentation, yet I have seen many code snippets using this as below.

capabilities.setCapability("deviceType", "phone"); 
capabilities.setCapability("device", "Android"); 

Can anyone please help?

Upvotes: 3

Views: 4628

Answers (1)

Khalid Abdlqader
Khalid Abdlqader

Reputation: 309

Will answer your questions one by one.

1) UDID: is used just when you want to run with ios device, this capability not applicable for android, and its just for ios "real devices" not emulators, and you could bring the uuid for ios device from itunes, or from devices information window through xcode.

2) deviceName: command "adb devices" will show the name of all connected devices, no uuid is not the same device name and remember uuid is just for ios "real devices" only, and for emulators you can just but "Android Emulator", anyway if you but a wrong device name in capabilities it should run also since appium will look for the connected device, you will have a probelm just if you have more than device connected to your machine.

3) this is needed when run with a virtual machine "emulator", and if you are running through an appium sevrer running in your machine you do not need to pass this capability at all.

4) i did not see these capabilities in appium at all and i do not see any use of them, the code you saw it may be a very old version of appium and it was required at that time.

Upvotes: 4

Related Questions