Appium-OSX
Tutorial
Required software:
Java: JDK
Appium : http://appium.io
Any java IDE: Eclipse / Intellij idea
Appium java client : https://mvnrepository.com/artifact/io.appium/java-client/4.1.2
Selenium stand alone server : https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server-standalone/2.53.0
Xcode : developer.apple.com/xcode/downloads : version 5.1 or
higher (i.e 6.1 )
( for opening Iphone simulator)
-
Command line tools (OS X 10.9).pkg
-
Xcode_6.1.1.dmg
Device Configuration : Enable UI automation in mobile (1.Connect your mobile
to laptop. 2. Go to settings 3. Developper
4. Enable UI automation
Iphone Simulator
verification:
Open Xcode
Click on Create a new Xcode project – Choose single view
application – product name : test,
language : Objective c, Device: Universal
Next
Choose folder name
Create
Click on Run
If it opens a simulator, you are done and then you can close
everything.
Installation:
Install Appium and
choose IOS
Click on Apple symbol to add or modify settings
Basic Tab:
Provide App path : App which you want to automate ( download
app in your local .ipa extension)
Force Device : check the check box and choose your connected
device
Platform version: UDID- Unique Device Id: (open xcode ->
Devices-> select the device you want to
test , you can find Identifier ,
this is the UDID ) (This is basically alias name , give Name: KranthiIphone6)
Full Rest : check the checkbox – every time we run test we
have a clean start
Advanced tab:
Xcode path : make sure xcode path pointed to actual
installation
Click on launch button
Once you see 200 in the console, you can start inspecting
elements
Click on Inspector UI ( magnifier symbol )
This will install the app on your mobile and shows screen in
inspector
We can choose any element and find xpath for the same
Appium setup
Check:
Click on Appium Doctor button
Code sample:
Open Eclipse
Create a maven project
Add appium-client and selenium server standalone jar to
build path
Public class FirstTest{
Public static void main(String[] args){
DesiredCapabilities cap=new DesiredCapabilities();
Cap.setCapabilities(“platformName”,”ios”);
Cap.setCapabilities(“platformVersion”,”8.1”);
Cap.setCapabilities(“deviceName”,” KranthiIphone6”);// this
we configured earlier in appium server
IOSDriver driver=new IOSDriver(new URL(http://127.0.0.1:4723/we/hub”),cap);
Driver.manage.timeouts().implicitwiat(60,TimeUnits.SECONDS);
Driver.findElement(By.xpath(“xpath”)).click();
//we can build our own xpaths by copying xpath of the device
screen and then we can write xpaths
//xpathtester.com/xpath
Driver.quite();
}