Sunday, October 22, 2017

Installing Appium + Node - Mac


Following steps worked for me[On Mac OS]. 

Mac OS : 10.11.6 OS X EI Capitan
Xcode : 8.1
Appium : 1.6.0
Appium GUI : 1.2.3 dmg
npm : 5.4.2(after upgrade)
node: 6.3.0

Prior to this you need to have XCode[for iOS] and Android Studio[for Android] installed in your machine.

For Appium we need to install Node JS and also carthage.



1)  Install Node and set proxy for node.

Download and install this node pkg. It will install npm too.


If your machine is behind a proxy then Set Proxy using below commands

npm set proxy http://<proxy url>:<port>
npm set https.proxy https://<proxy url>:<port>


Set No proxy variable.
export no_proxy=localhost,127.0.0.1
export http_proxy=http://<proxy url>:<port>


2)  Install carthage


3) we need to upgrade the node version and the install appium.

Upgrading npm
sudo npm install npm@latest -g

Set All Proxy and then install appium because it downloads chromedriver.zip using curl
export ALL_PROXY=<proxy url without http>:<port>
export no_proxy=localhost,127.0.0.1
export http_proxy=http://<proxy url>:<port>

npm set proxy http://<proxy url>:<port>
npm set https.proxy https://<proxy url>:<port>

Run 
npm install appium@1.6.0


It will take some 10 min time for installing.

Once the installation is successful. verify appium directory inside node.

cd~ 
/Users/sriramkukkadapu/node_modules/appium

4)
Install appium-doctor
npm install appium-doctor

npm install appium-doctor –g


after it is done type this command. it will show us if anything is wrong.
appium-doctor


If it shows JAVA_HOME bin is not set properly then run this commands or set JAVA bin path.

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
export PATH=$PATH:$JAVA_HOME/bin


5) To authorize npm for iOS

npm install -g authorize-ios appium-doctor appium-gulp-plugins authorize-ios



6)  Install appium 1.2.4 dmg file. This is for appium GUI
https://github.com/appium/appium-desktop/releases/

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.

So to run the .apk file we need android studio [Emulator]
to run the .app file we need xcode [Simulator]


No comments:

Post a Comment

How to avoid our mails going to spam - FIx the issue in 3 simple steps

If you see our emails from (info@jobcurator.in) are going to spam, fix it using below steps. Note: Try this in desktop/laptop 1) Go to any...