appium 1.6.3 + ios 10.2 + xcode 8.2.1 真機運行safari

啓動appium 命令:html

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"node

        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);

遇到問題:ios

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

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

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

 

參考:https://github.com/appium/appium/issues/6892npm

解決辦法:bootstrap

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

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'

相關文章
相關標籤/搜索