zoukankan      html  css  js  c++  java
  • Appium + junit 的简单实例

    import static junit.framework.Assert.assertTrue;
    import static org.junit.Assert.*;
    
    import org.junit.After;
    import org.junit.Before;
    import org.junit.Test;
    import java.net.URL;
    import io.appium.java_client.AppiumDriver;
    import io.appium.java_client.android.AndroidDriver;
    
    import org.openqa.selenium.By;
    import org.openqa.selenium.remote.CapabilityType;
    import org.openqa.selenium.remote.DesiredCapabilities;
    
    public class AppiumTestCase {
    	AppiumDriver driver;
    
    	@Before
    	public void setUp() throws Exception {
    		DesiredCapabilities capabilities = new DesiredCapabilities();
    		capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
    		capabilities.setCapability("platforName", "Android");
    		capabilities.setCapability("deviceName", "05157df53de0042b");
    		capabilities.setCapability("platformVersion", "6.0.1");
    		capabilities.setCapability("appPackage", "com.sec.android.app.popupcalculator");
    		capabilities.setCapability("appActivity", ".Calculator");
    		driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities);
    	}
    
    	@After
    	public void tearDown() throws Exception {
    		driver.quit();
    	}
    
    	@SuppressWarnings("deprecation")
    	@Test
    	public void test1() {
    		driver.findElement(By.name("9")).click();
    		driver.findElement(By.name("5")).click();
    		driver.findElement(By.name("+")).click();
    		driver.findElement(By.name("6")).click();
    		driver.findElement(By.name("=")).click();
    		
    		assertTrue("ok", driver.findElement(By.name("101")).isDisplayed());
    		
    	}
    	
    	@SuppressWarnings("deprecation")
    	@Test
    	public void test2() {
    		driver.findElement(By.name("9")).click();
    		driver.findElement(By.name("5")).click();
    		driver.findElement(By.name("+")).click();
    		driver.findElement(By.name("7")).click();
    		driver.findElement(By.name("=")).click();
    		
    		assertTrue("ok", driver.findElement(By.name("102")).isDisplayed());
    		
    	}
    
    }
    

      

    Appium服务关键字

    参考:http://www.cnblogs.com/puresoul/p/4709189.html

    Appium使用总结

    参考:http://www.cnblogs.com/tobecrazy/category/699177.html

    http://www.2cto.com/kf/201501/368019.html

    Appium定位方法总结

     参考:http://www.2cto.com/kf/201410/340345.html

    http://blog.csdn.net/today520/article/details/37815087

    Appium实例收集

    参考:http://blog.csdn.net/wirelessqa/article/details/29188455

  • 相关阅读:
    修炼一名程序员的职业水准_转
    system执行shell命令
    (转)MySql数据库索引原理(总结性)
    (转)SQL Server基础之存储过程(清晰使用)
    (转)菜鸟学数据库(三)——存储过程
    (转)菜鸟学数据库(二)——触发器
    (转)SqlServer基础之(触发器)(清晰易懂)
    (转)菜鸟学数据库(一)——三范式
    (转)HTTP 协议详解(基础)
    (转)HTTP协议漫谈
  • 原文地址:https://www.cnblogs.com/moonpool/p/5461503.html
Copyright © 2011-2022 走看看