Created
June 20, 2013 19:54
-
-
Save freynaud/5826066 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Test { | |
public static void main(String[] args) throws Exception { | |
String[] a = {"-port", "4444", "-host", "localhost", | |
"-aut", "/Users/freynaud/eBay.app"}; | |
IOSServerConfiguration config = IOSServerConfiguration.create(a); | |
IOSServer server = new IOSServer(config); | |
server.start(); | |
IOSCapabilities cap = IOSCapabilities.iphone("eBay"); | |
cap.setCapability(IOSCapabilities.SIMULATOR, true); | |
//cap.setCapability(IOSCapabilities.IOS_SWITCHES, | |
// Arrays.asList(new String[]{"-e", "useQA", "YES"})); | |
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), cap); | |
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); | |
WebElement agree = driver.findElement(By.name("Agree")); | |
agree.click(); | |
driver.switchTo().alert().dismiss(); | |
WebElement signInButton = driver.findElement(By.xpath("//UIAButton[@name='Sign In']")); | |
signInButton.click(); | |
WebElement user = driver.findElement(By.xpath("//UIATextField[@value='User ID']")); | |
user.sendKeys("a"); | |
WebElement pass = driver.findElement(By.xpath("//UIASecureTextField[@value='Password']")); | |
pass.sendKeys("b"); | |
WebElement element4 = driver.findElement(By.xpath("//UIAButton[@name='Done']")); | |
element4.click(); | |
Thread.sleep(2000); | |
// navigate | |
WebElement input = driver.findElement(By.className("UIASearchBar")); | |
input.sendKeys("130005506066"); | |
WebElement search = driver.findElement(By.xpath("//UIAButton[@label='search']")); | |
search.click(); | |
// watch | |
WebElement | |
popup = | |
driver.findElement(By.name( | |
"Tap this star to save a search. We can even notify you when new matching items are found!")); | |
popup.click(); | |
WebElement result = driver.findElement(By.xpath("//UIATableCell")); | |
result.click(); | |
WebElement watch = driver.findElement(By.name("Watch")); | |
watch.click(); | |
Thread.sleep(2000); | |
driver.quit(); | |
server.stop(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment