appium 1.6.3 + ios 10.2 + xcode 8.2.1 真机运行iphone app

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" --app "com.abc.abcdef" --udid "f9b87274e2a24b310399dd56dd80f8561d99fdac" --show-ios-log --device-name "iPhone 6s Plus"

 

testng用例代码:

        IOSDriver<MobileElement> driver = null;
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "10.2");
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 6s Plus");
        capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
        capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
        capabilities.setCapability(MobileCapabilityType.APP, "/Users/apptest/Downloads/abcdef.ipa");
        capabilities.setCapability(MobileCapabilityType.UDID, "f9b87274e2a24b310399dd56dd80f8561d99fdac");
        // capabilities.setCapability(MobileCapabilityType.,"f9b87274e2a24b310399dd56dd80f8561d99fdac");
        try {
            driver = new IOSDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

            driver.findElementByName("个人中心").click();
            driver.findElementByName("首页").click();
    

 

posted @ 2017-01-20 13:46  testway  阅读(1631)  评论(0编辑  收藏  举报