Professional Documents
Culture Documents
APPIUM
Appium is an open source test automation framework for use with native, hybrid and mobile web
apps.
It drives iOS and Android apps using the WebDriver protocol.
Appium is "cross-platform": it allows you to write tests against multiple platforms (iOS, Android),
using the same API. This enables code reuse between iOS and Android testsuites.
Appium Setup
https://dl-ssl.google.com/android/eclipse/
Appium By Nagesh
Note: The Android Developer Tools update site requires a secure connection. Make sure the
update site URL you enter starts with HTTPS.
5. Click OK.
6. In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
7. In the next window, you'll see a list of the tools to be downloaded. Click Next.
8. Read and accept the license agreements, then click Finish.
If you get a security warning saying that the authenticity or validity of the software can't be
established, click OK.
9. When the installation completes, restart Eclipse.
10. Download Android sdk zip file from the site http://developer.android.com/sdk/index.html
11. Extract the zip file
12. Create the environment variable as below
ANDROID_HOME: E:\adt-bundle-windows-x86_64-20140321\adt-bundle-windows-x86_64-20140321\sdk
path: E:\adt-bundle-windows-x86_64-20140321\adt-bundle-windows-x86_64-20140321\sdk\platform-tools;
E:\adt-bundle-windows-x86_64-20140321\adt-bundle-windows-x86_64-20140321\sdk\tools
13. Download the appium zip file from the site http://appium.io/
15. Add all the below jar files for the project
Selenium-server-standalone jar file
selenium java client jar files
google-gson jar files(https://code.google.com/p/google-
gson/downloads/detail?name=google-gson-2.2.4-release.zip&)
Appium java client jar file (https://github.com/appium/java-
client)
Q) How to get the App Package & App Activity details for any Device..? ( I mean for any new device)
20. Note: Make sure that you have connected your device to the system..! Otherwise we cant take the App
Package & App Activity.
21. Open the command prompt Type the following command to get the App Package & App Activity.
22.
23. It will display as below:
Appium By Nagesh
24.
25. Copy the content and paste it any word pad / Edit Plus ..etc
26. Now search with the word CurrentFocus.
27. Here we can see the APP Package &App Activity. Copy it and paste it in the excel sheet.
Note: The system IP address needs to be provided in RemoteWebdriver Command and appium
settings
package com.example.android.supportv13;
import java.net.URL;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
@Before
public void setUp() throws Exception {
DesiredCapabilities dc=new DesiredCapabilities();
dc.setCapability("deviceName", "Nagesh");
dc.setCapability("platformVersion", "4.4.4");
dc.setCapability("platformName", "Android");
dc.setCapability("browserName", "Chrome");
dc.setCapability("appPackage", "com.sec.android.app.launcher");
dc.setCapability("appActivity", "com.android.launcher2.Launcher");
driver=new RemoteWebDriver(new
URL("http://192.168.1.13:4723/wd/hub"),dc);
}
@Test
public void test() throws Exception{
System.out.println("Started");
Thread.sleep(4000);
driver.get("http://gmail.com");
driver.findElement(By.id("Email")).sendKeys("testingse2");
driver.findElement(By.id("next")).click();
Thread.sleep(2000);
driver.findElement(By.id("Passwd")).sendKeys("selenium");
driver.findElement(By.id("signIn")).click();
Thread.sleep(2000);
}
package com.example.android.supportv13;
import java.net.MalformedURLException;
import java.net.URL;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
@Before
public void setUp() throws Exception {
}
@Test
public void test() throws Exception {
//File f=new File("D:\\Whats app\\WhatsApp.apk");
DesiredCapabilities dc=new DesiredCapabilities();
//dc.setCapability(CapabilityType.BROWSER_NAME, "firefox");
dc.setCapability("deviceName", "Nagesh");
dc.setCapability("platformVersion", "4.4.4");
dc.setCapability("platformName", "Android");
//dc.setCapability("browserName", "Chrome");
//dc.setCapability("f", f.getAbsolutePath());
dc.setCapability("appPackage", "com.sec.android.app.launcher");
dc.setCapability("appActivity", "com.android.launcher2.Launcher");
driver=new RemoteWebDriver(new
URL("http://192.168.1.4:4723/wd/hub"),dc);
System.out.println("Started");
Thread.sleep(4000);
//driver.findElement(By.xpath("//android.widget.TextView[@index='0']")).cl
ick();
driver.findElement(By.xpath("//android.widget.TextView[@text='Phone']")).
click();
//driver.quit();
driver.findElement(By.id("com.android.contacts:id/nine")).click();
Appium By Nagesh
driver.findElement(By.id("com.android.contacts:id/eight")).click();
driver.findElement(By.id("com.android.contacts:id/four")).click();
driver.findElement(By.id("com.android.contacts:id/eight")).click();
driver.findElement(By.id("com.android.contacts:id/seven")).click();
driver.findElement(By.id("com.android.contacts:id/three")).click();
driver.findElement(By.id("com.android.contacts:id/four")).click();
driver.findElement(By.id("com.android.contacts:id/five")).click();
driver.findElement(By.id("com.android.contacts:id/nine")).click();
driver.findElement(By.id("com.android.contacts:id/five")).click();
driver.findElement(By.id("com.android.contacts:id/five")).click();
driver.findElement(By.id("com.android.contacts:id/callbutton")).click();
Thread.sleep(3000);
driver.findElement(By.xpath("//android.widget.Button[@text='End
call']")).click();
IE Xpath:
http://functionaltestautomation.blogspot.in/2008/12/xpath-in-internet-
explorer.html