Appium-ios starts deome
package com.appium.cases;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
import io.appium.java_client.remote.IOSMobileCapabilityType;
import io.appium.java_client.remote.MobileCapabilityType;
import java.io.File;
import java.net.URL;
public class IOSDeijtong {
IOSDriver driver;
//Command line startup
@BeforeClass
public void setUp() throws Exception {
File appDir = new File(System.getProperty("user.dir"));
final File app = new File(appDir, "/app/Toon.ipa");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName","IOS"); //mobile os
capabilities.setCapability("platformVersion", "11.0.3"); //OS version of phone to boot
capabilities.setCapability("deviceName", "iPhonexq"); //phone type or simulator type, e.g. MI_2A/Android Emulator/iPhone Simulator
capabilities.setCapability("udid","0259411d3508a459149c8aec521ff5845a2e835b"); //physical machine ID //Mac platform used a779c7953c50967fca89500e932981029e306659
capabilities.setCapability("useNewWDA",false); //false
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 3600);
//capabilities.setCapability (IOSMobileCapabilityType.AUTO_ACCEPT_ALERTS, true); //All IOS alerts appear with option ACCEPT
capabilities.setCapability("bundleId", "com.systoon.beijingtong");
capabilities.setCapability("app", app.getAbsolutePath()); //Get the absolute path of the app (a path under the project is enabled if installed, not started if not installed)
driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
@Test
public void allinLogin() throws InterruptedException { //Login
/** Allow */
Thread.sleep(5000);
//System.out.println (driver.getPageSource()); //get element
//driver.findElement (By.name ("Allow")).click();
//Login Username XCUIElementTypeTextField
driver.findElementByName("Please enter mobile number").clear();
driver.findElementByName("Please enter the mobile phone number").sendKeys("1472500001");
//Password
driver.findElementByName("Please enter your password").sendKeys("1111");
//Login
driver.findElementByName("Login").click();
Thread.sleep(5000);
System.out.println("This is the login page");
System.out.println(driver.getPageSource()); //get element
//final WebElement text = river.findElement(By.xpath("//UIATextField[1]"));
}
@AfterClass
public void tearDown() throws Exception {
// driver.quit();
}
}