Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save prashanth-sams/bdf837a8497ecf35b3dd to your computer and use it in GitHub Desktop.
Save prashanth-sams/bdf837a8497ecf35b3dd to your computer and use it in GitHub Desktop.
package pack;
import java.net.URL;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
//import io.appium.java_client.AppiumDriver;
import org.testng.annotations.Test;
public class saucetest{
public WebDriver driver = null;
//public AppiumDriver driver = null;
@BeforeTest
public void setUp() throws Exception {
// set up appium
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("platformVersion", "6.1");
capabilities.setCapability(CapabilityType.PLATFORM, "Mac");
capabilities.setCapability("app", "sauce-storage:IMs.zip");
capabilities.setCapability("name","Appium Java iOS Test");
capabilities.setCapability("deviceName", "iPhone Simulator");
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("appium-version", "1.0.0");
driver = new RemoteWebDriver(new URL("http://kimr01:[email protected]/wd/hub"), capabilities);
}
@AfterTest
public void tearDown() throws Exception {
driver.quit();
}
@Test
public void test01() throws InterruptedException {
driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[3]")).click();
Thread.sleep(2000);
driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[1]")).click();
Thread.sleep(2000);
driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[5]")).click();
Thread.sleep(2000);
driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[1]")).click();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment