[英]Build errors of Appium Android test
I am a beginner of Appium and Java. 我是Appium和Java的初学者。 When I perform my first demo for Android test, I just get 2 errors and have no idea how to fix them after google.
当我为Android测试执行我的第一个演示时,我仅遇到2个错误,并且不知道在Google之后如何解决它们。 So I have to find some help here.
所以我必须在这里找到一些帮助。 Code:
码:
import java.net.MalformedURLException;
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.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
public class AutoTest {
private AndroidDriver<WebElement> driver;
@Before
public void Setup() throws MalformedURLException{
//File classPathRoot = new java.io.File(System.getProperty("user.dir"));
//File appDir = new File(classPathRoot,"app/login.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "emulator-5554");
capabilities.setBrowserName("Android");
capabilities.setCapability(CapabilityType.VERSION, "6.0.1");
capabilities.setPlatform(Platform.ANDROID);
//capabilities.setCapability("app", appDir.getAbsolutePath());
capabilities.setCapability("appPackage", "com.study.kukaka.login");
capabilities.setCapability("appActivity", "LoginActivity");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723"),capabilities);
}
@Test
public void test() {
driver.findElement(By.id("email")).sendKeys("myemail@hotmail.com");
driver.findElement(By.id("password")).sendKeys("whatever");
driver.findElement(By.id("email_sign_in_button")).click();
System.out.println("Test pass!");
}
@After
public void End(){
driver.quit();
}
}
And the errors: 和错误:
The library I used is as below. 我使用的库如下。 Library I used
我使用的图书馆
Any help is appreciated! 任何帮助表示赞赏!
You may need to selenium remote driver jar file to build path. 您可能需要使用Selenium远程驱动程序jar文件来构建路径。 ( I could not seen it your build path ) Download from maven http://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-remote-driver/2.44.0 and put it to your build path.
(我看不到它是您的构建路径)从maven下载http://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-remote-driver/2.44.0并将其放入您的构建路径。 If not works again, putting error logs will be more heplfull.
如果仍然无法正常运行,则放置错误日志将更加有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.