appium + java + WebDriverAgent实现IOS app启动

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下载使用

第二步: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);

转载于:https://www.cnblogs.com/freestudy/p/9449874.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值