appium 1.6.3 + ios 10.2 + xcode 8.2.1 真机运行safari

启动appium 命令:

appium --address "127.0.0.1" --session-override --pre-launch --debug-log-spacing --log "/tmp/appium.log" --platform-version "10.2" --platform-name "iOS" --safari --browser-name "Safari" --udid "f9b87274e2a24b310399dd56dd80f8561d99fdac" --show-ios-log --device-name "iPhone 6s Plus"

        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "safari");
        capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "10.2");
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 6s Plus");
        capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
        capabilities.setCapability(MobileCapabilityType.UDID,"f9b87274e2a24b310399dd56dd80f8561d99fdac");
        driver = new IOSDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

遇到问题:

[debug] [XCUITest] Waiting for WebDriverAgent server to finish loading...

[debug] [XCUITest] Waiting for WebDriverAgent server to finish loading...

[debug] [XCUITest] Waiting for WebDriverAgent server to finish loading...

 

参考:https://github.com/appium/appium/issues/6892

解决办法:

安装最新版本的appium + appium-xcuitest-driver@2.5.3

cd /usr/local/lib/node_modules/appium
npm uninstall appium-xcuitest-driver
npm install appium-xcuitest-driver@2.5.3

cd  /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent


 mkdir -p Resources/WebDriverAgent.bundle


sh ./Scripts/bootstrap.sh -d



安装后,还需要编译
appium-xcuitest-driver 打开项目文件使用命令:

open /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj/

编译方法
参考:http://www.cnblogs.com/testway/p/6298126.html
执行如下命令,会在手机上安装一个 WebDriver 程序

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=f9b87274e2a24b310399dd56dd80f8561d99fdac' test


执行
这些步骤后,可以打开iphone的safari浏览器,但是默认打开的网页地址为appium.io 同时appium日志提示:

2017-01-19 12:13:03:750 - warn: [iOS] Attempted to get a list of webview contexts but could not connect to ios-webkit-debug-proxy. If you expect to find webviews, please ensure that the proxy is running and accessible

2017-01-19 12:13:03:750 - info: [debug] [iOS] No web frames found.

2017-01-19 12:13:03:750 - warn: [iOS] Could not find any webviews yet, refreshing/retrying

2017-01-19 12:13:03:792 - info: [iOSLog] [IOS_SYSLOG_ROW] Jan 19 20:12:51 iPhone locationd[63] <Notice>: message 'kCLConnectionMessageWatchdog' received from client '/System/Library/LocationBundles/WifiCalling.bundle'

 
posted @ 2017-01-19 16:03  testway  阅读(2081)  评论(0编辑  收藏  举报