您的位置:首页 > 移动开发

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

2017-01-19 16:03 615 查看
启动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"iPhone6sPlus"

DesiredCapabilitiescapabilities=newDesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME,"safari");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION,"10.2");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,"iPhone6sPlus");
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME,"XCUITest");
capabilities.setCapability(MobileCapabilityType.UDID,"f9b87274e2a24b310399dd56dd80f8561d99fdac");
driver=newIOSDriver<MobileElement>(newURL("http://127.0.0.1:4723/wd/hub"),capabilities);


遇到问题:

[debug][XCUITest]WaitingforWebDriverAgentservertofinishloading...

[debug][XCUITest]WaitingforWebDriverAgentservertofinishloading...

[debug][XCUITest]WaitingforWebDriverAgentservertofinishloading...

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

解决办法:

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


cd/usr/local/lib/node_modules/appium
npmuninstallappium-xcuitest-driver
npminstallappium-xcuitest-driver@2.5.3



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


mkdir-pResources/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-projectWebDriverAgent.xcodeproj-schemeWebDriverAgentRunner-destination'id=f9b87274e2a24b310399dd56dd80f8561d99fdac'test


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


2017-01-1912:13:03:750-warn:[iOS]Attemptedtogetalistofwebviewcontextsbutcouldnotconnecttoios-webkit-debug-proxy.Ifyouexpecttofindwebviews,pleaseensurethattheproxyisrunningandaccessible

2017-01-1912:13:03:750-info:[debug][iOS]Nowebframesfound.

2017-01-1912:13:03:750-warn:[iOS]Couldnotfindanywebviewsyet,refreshing/retrying

2017-01-1912:13:03:792-info:[iOSLog][IOS_SYSLOG_ROW]Jan1920:12:51iPhonelocationd[63]<Notice>:message'kCLConnectionMessageWatchdog'receivedfromclient'/System/Library/LocationBundles/WifiCalling.bundle'


                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: