appium命令行启动:
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 19.0px "Andale Mono"; color: #29f914; background-color: #000000 }
span.s1 { }
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();
时间: 2024-12-19 03:37:52