Appium v1.8.1
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.14.0</version>
</dependency>
一、WebDriverAgent下載使用
第一步:git clone
https://github.com/facebook/WebDriverAgent.git
第二步:brew install Carthage
第三步:
cd /Users/用戶名/Downloads/WebDriverAgent-master(WebDriverAgent-master要根目錄)
./Scripts/bootstrap.sh
第四步:用雙擊WebDriverAgent.xcodeproj會自動打開xcode,進入如下頁面




執行成功后會在真機上安裝成功WebDriverAgentRunner-Runner,這時候就成功一大半了。
java代碼,打開IOS APP應用的代碼。
public WebDriver iosDriver;
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iphone7");
desiredCapabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
desiredCapabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
desiredCapabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "11.2.1");
desiredCapabilities.setCapability(MobileCapabilityType.APP,
“com.xxx.xxx");
desiredCapabilities.setCapability(MobileCapabilityType.UDID,
“xx5d57d6a80afxx4d4917ba2af1845ec07c431xx");
URL url = new URL("
http://127.0.0.1:4723/wd/hub");
iosDriver = new RemoteWebDriver(url, desiredCapabilities);