Follow My Blog If u Like...!

Wednesday, November 22, 2017

Connect your android deviceGo to Settings->About Phone/Device -> Tap on the build number 7 timesyou will go to developer mode.Just above the option About device you will find "Developer Options" setting. tap on that.Enable USB debugging.It would ask for a confirmation of RSA fingerprint. Click on Ok.Now go to terminal/command prompt and run the command "adb devices"Your device will be listed with device id.In the android capabilities in your code you can use the above device id as udid Ex: udid=c55c70af04399e58

Before starting Appium server make sure Xcode is pointed to right path.

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

If Xcode is not set properly errors might come.

In the appium you need to specify the capabilities for appium server to start. I am listing the capabilities which i have used, for iOS and Android apps. modify them accordingly and point appium to your mobile app with "app" : <path> parameter

Once the capabilities are defined(for any deivce ex: iOS or Android)

Open appium(GUI). Click on Start Inspector Session.

Select the configuration(any of the capabilities below) and

Click on Start Session.

Capabilities are below for iOS

{

"platformName": "iOS",

"deviceName": "iPhone 7",

"app": "/Users/sriramkukkadapu/TestApp.app",

"automationName": “XCUITest”

}

Capabilities for Android

{

"platformName": "Android",

"deviceName": "Android Emulator",

"app": "/Users/sriramkukkadapu/TestAPP.apk",

"automationName": "Appium",

"platformVersion": "7.1.1",

"appPackage": "<app package>",

"appActivity": “<app activity>”

"avd": "Nexus_5X_API_25_1"

}

If we dont specify avd prameter

For Android devices(if it says cannot recognize any devices)

then open android studio start any device

and run this command to check the device status. Android_HOME/platform-tools has this command

adb devices

once device is listed and active it will be recognized by appium.

7)To see the list of Android virtual devices.

emulator -list-avds

my mac has below devices

Nexus_5X_API_25_1

Nexus_5X_API_26_-_Android_8.0

use the same name in capabilities as avd name

Note:

For Android we all know that .apk is the setup file(which will be used to run the application)

For iOS .ipa is the file which user will be able to install the application but to generate a .ipa file apple license is required so there is a separate .app file which XCode tool generates for us to install it on the virtual device and run the application.