Skip to content

Instantly share code, notes, and snippets.

@prashanth-sams
Created June 21, 2014 11:53
Show Gist options
  • Save prashanth-sams/a0f239b976e4c2b0d8ee to your computer and use it in GitHub Desktop.
Save prashanth-sams/a0f239b976e4c2b0d8ee to your computer and use it in GitHub Desktop.
package pack;
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.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.net.URL;
import java.util.concurrent.TimeUnit;
public class Desktop {
public WebDriver driver = null;
@BeforeMethod
public void setUp() throws Exception{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "iOS");
capabilities.setCapability(CapabilityType.VERSION, "6.1");
capabilities.setCapability(CapabilityType.PLATFORM, "Mac");
capabilities.setCapability("deviceName", "iPhone");
capabilities.setCapability("app","/Users/prashanth_sams/Downloads/InternationalMountains/build/Release-iphonesimulator/InternationalMountains.app");
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4725/wd/hub"), capabilities);
}
@AfterMethod
public void tearDown() throws Exception {
driver.quit();
}
@Test
public void test01() throws InterruptedException {
driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[5]")).click();
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