标签:
知乎Android客户端登陆:http://www.cnblogs.com/tobecrazy/p/4579631.html
appium实现截图和清空EditText:http://www.cnblogs.com/tobecrazy/p/4592405.html
appium 滑动处理:http://www.cnblogs.com/tobecrazy/p/4612133.html
ChromeDriver:http://www.cnblogs.com/tobecrazy/p/4836995.html
appium 九宫格解锁招商银行手机客户端app :http://www.cnblogs.com/tobecrazy/p/4881390.html
Hybrid app webview :http://www.cnblogs.com/tobecrazy/p/4905917.html
java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode
Youngs-Mac:~ root# instruments -s devices
Known Devices:
Young’s Mac [564D792F-BB12-9F15-EF80-A723B921B505]
Resizable iPad (8.4 Simulator) [B477C6F2-F8A9-4CE1-9889-C7BB1518D0B9]
Resizable iPhone (8.4 Simulator) [56007C43-7BAB-4C7A-BA5B-E42DEE41C4B4]
iPad 2 (8.4 Simulator) [D69DF503-8F09-47EB-AC67-385FFACC01D1]
iPad Air (8.4 Simulator) [D9E1F7CE-A110-4167-B6C8-F50EA83B8CDC]
iPad Retina (8.4 Simulator) [C704AFE0-BC72-4AAF-8B51-7CEE0D021355]
iPhone 4s (8.4 Simulator) [D03258C7-8619-4BA2-8EAB-6D88EAFE641C]
iPhone 5 (8.4 Simulator) [2C39AE81-2B7D-48FC-B6C9-52203A53A560]
iPhone 5s (8.4 Simulator) [A66F0F82-AB4C-4BAC-B466-9BF44FC7B03C]
iPhone 6 (8.4 Simulator) [C8395C58-5164-406B-9DF8-47BAE209EC25]
iPhone 6 Plus (8.4 Simulator) [51C387A1-B77E-4BE4-99E0-BBA1F95E9789]
npm -version
2.14.7
package com.dbyl.core; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import io.appium.java_client.ios.IOSDriver; import java.io.File; import java.net.URL; import java.util.concurrent.TimeUnit; public class iOSTest { private IOSDriver driver; private boolean isInstall = true; @BeforeClass(alwaysRun = true) public void setUp() throws Exception { // set up appium DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(CapabilityType.BROWSER_NAME, "iOS"); capabilities.setCapability("platformName", "Mac"); capabilities.setCapability("deviceName", "iPhone 6"); capabilities.setCapability("platformVersion", "8.4"); // if no need install don‘t add this if (isInstall) { File classpathRoot = new File(System.getProperty("user.dir")); File appDir = new File(classpathRoot, "apps"); File app = new File(appDir, "TestApp.app"); System.out.println("---->"+app.getAbsolutePath()); capabilities.setCapability("app", app.getAbsolutePath()); } // support Chinese capabilities.setCapability("unicodeKeyboard", "True"); capabilities.setCapability("resetKeyboard", "True"); driver = new IOSDriver (new URL("http://127.0.0.1:4723/wd/hub"), capabilities); } @Test public void login() { // wait for 20s driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); // find login userName and password editText WebElement inputbox1 =driver.findElementByName("TextField1"); inputbox1.sendKeys("12"); WebElement inputbox2 =driver.findElementByName("TextField2"); inputbox2.sendKeys("65"); WebElement calcButton=driver.findElementByXPath("//UIAApplication[1]/UIAWindow[2]/UIAButton[1]"); calcButton.click(); WebElement result=driver.findElementByXPath("//UIAApplication[1]/UIAWindow[2]/UIAStaticText[1]"); Assert.assertEquals(result.getAttribute("value"), "77"); } @AfterClass(alwaysRun = true) public void tearDown() throws Exception { driver.quit(); } }
视频教程:https://www.youtube.com/watch?v=BULjgsTpw2c
代码:https://github.com/tobecrazy/appiumDemo
标签:
原文地址:http://www.cnblogs.com/tobecrazy/p/4970188.html