7-5 运行junit test时提示如下图错误

来源:7-5 Appium定位应用界面元素的方法

艳艳__

2017-05-28

http://szimg.mukewang.com/592adf600001fb4013930457.jpg

写回答

2回答

慕尼黑50678

2019-10-12

我也遇到这个问题了,解决了吗

0
0

艳艳__

提问者

2017-05-28

package com.imooc.test;


import static org.junit.Assert.*;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;


import java.net.URL;


import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;


public class AppTest1 {
 AppiumDriver driver;


 @Before
 public void setUp() throws Exception {
  DesiredCapabilities cap=new DesiredCapabilities();
  cap.setCapability("deviceName", "emulator-5554");
  cap.setCapability("platformVersion","4.3.1");
     cap.setCapability("appPackage", "com.android.calculator2");
     cap.setCapability("appActivity",".Calculator");
  
  cap.setCapability("automationName","Appium");
  cap.setCapability("platformName","Android");
  
  driver=new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"),cap);
 }


 @After
 public void tearDown() throws Exception {
  driver.quit();
 }


 @Test
 public void test() throws InterruptedException {
  driver.findElement(By.id("digit6")).click();
  driver.findElement(By.id("digit7")).click();
  Thread.sleep(6000);
 }


}


0
0

Android自动化测试实战 Java篇主流工具,框架,脚本

Android测试工程师大逆转的必备技能课程

1362 学习 · 476 问题

查看课程