WordPress deleted this post, I’ll work on restoring it
This file contains 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
<XCUIElementTypeApplication name="TestApp"> | |
<XCUIElementTypeOther> | |
<XCUIElementTypeWindow> | |
<XCUIElementTypeOther> | |
<XCUIElementTypeTextField name="IntegerA"> | |
<XCUIElementTypeTextField name="IntegerB"> | |
<XCUIElementTypeButton name="ComputeSumButton"> | |
<XCUIElementTypeStaticText name="Answer"> | |
<XCUIElementTypeButton name="show alert"> | |
<XCUIElementTypeButton name="contact alert"> | |
<XCUIElementTypeButton name="location alert"> | |
<XCUIElementTypeStaticText name="AppElem"> | |
<XCUIElementTypeSlider name="AppElem"> | |
<XCUIElementTypeStaticText name="AppElem"> | |
<XCUIElementTypeButton name="DisabledButton"> | |
<XCUIElementTypeStaticText> | |
<XCUIElementTypeSwitch name="locationStatus"> | |
<XCUIElementTypeButton name="Test Gesture"> | |
<XCUIElementTypeButton name="Crash"> | |
<XCUIElementTypeStaticText name="Access'ibility"> | |
<XCUIElementTypeButton name="Check calendar authorized"> | |
<XCUIElementTypeWindow> | |
<XCUIElementTypeWindow> | |
<XCUIElementTypeWindow> |
This file contains 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
import io.appium.java_client.MobileElement; | |
import io.appium.java_client.ios.IOSDriver; | |
import junit.framework.TestCase; | |
import org.junit.After; | |
import org.junit.Before; | |
import org.junit.Test; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
import org.openqa.selenium.remote.DesiredCapabilities; | |
public class SampleTest { | |
private IOSDriver driver; | |
@Before | |
public void setUp() throws MalformedURLException { | |
DesiredCapabilities desiredCapabilities = new DesiredCapabilities(); | |
desiredCapabilities.setCapability("platformName", "iOS"); | |
desiredCapabilities.setCapability("platformVersion", "10.2"); | |
desiredCapabilities.setCapability("deviceName", "iPhone Simulator"); | |
desiredCapabilities.setCapability("deviceOrientation", "portrait"); | |
desiredCapabilities.setCapability("app", "sauce-storage:TestApp-iOS-10.2.zip"); | |
URL remoteUrl = new URL("http://ondemand.saucelabs.com:80/wd/hub"); | |
driver = new IOSDriver(remoteUrl, desiredCapabilities); | |
} | |
@Test | |
public void sampleTest() { | |
MobileElement el1 = (MobileElement) driver.findElementByAccessibilityId("IntegerA"); | |
el1.sendKeys("1"); | |
MobileElement el2 = (MobileElement) driver.findElementByAccessibilityId("IntegerB"); | |
el2.sendKeys("2"); | |
MobileElement el3 = (MobileElement) driver.findElementByAccessibilityId("ComputeSumButton"); | |
el3.click(); | |
List<MobileElement> els1 = (MobileElement) driver.findElementsById("Answer"); | |
} | |
@After | |
public void tearDown() { | |
driver.quit(); | |
} | |
} |