|
刚开始学习,一个简单的测试用例源码如下
:- package com.test;
- import io.appium.java_client.AppiumDriver;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
- import org.openqa.selenium.By;
- import org.openqa.selenium.WebElement;
- import org.openqa.selenium.remote.CapabilityType;
- import org.openqa.selenium.remote.DesiredCapabilities;
- import java.io.File;
- import java.net.URL;
- import java.util.List;
- public class FirstTest{
- private static final int user_phoneno_edt = 0;
- private AppiumDriver driver;
- @Before
- public void setUp() throws Exception{
- DesiredCapabilities capabilities=new DesiredCapabilities();
- capabilities.setCapability(CapabilityType.BROWSER_NAME,"");
- capabilities.setCapability("platformName","Android");
- capabilities.setCapability("devicesName","9DS8FYGAJFPRQW7T");
- capabilities.setCapability("platformVersion","6.0");
-
- capabilities.setCapability("appPackage","com.greenpoint.android.mc10086.activity");
- capabilities.setCapability("appActivity","com.leadeon.cmcc.base.StartPageActivity");
-
- AppiumDriver diver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities);
- }
-
- @After
- public void tearDown() throws Exception{
- driver.quit();
- }
-
- @Test
- public void testfirst(){
- driver.findElementById("com.greenpoint.android.mc10086.activity:id/mine_login_btn").click();
- }
- }
复制代码
依赖的jar包也导入了,但是点击运行就出现下面的窗口:C:\Users\lenovo\Desktop |
|