我已经准备好了使用eclipse进行Android应用程序测试自动化的环境。我按照从下面的网站上的说明:“WebDriver无法解析为类型”错误Android WebDriver java代码
https://code.google.com/p/selenium/wiki/AndroidDriver#Setup_the_Environment
我已经复制下面的代码从上述网站如下:
import junit.framework.TestCase;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.android.AndroidDriver;
public class OneTest extends TestCase {
public void testGoogle() throws Exception {
WebDriver driver = new AndroidDriver();
// And now use this to visit Google
driver.get("http://www.google.com");
// Find the text input element by its name
WebElement element = driver.findElement(By.name("q"));
// Enter something to search for
element.sendKeys("Cheese!");
// Now submit the form. WebDriver will find the form for us from the element
element.submit();
// Check the title of the page
System.out.println("Page title is: " + driver.getTitle());
driver.quit();
}
}
但误差“的webdriver不能被解析为一个类型”为
WebDriver driver = new AndroidDriver();
注:在下面的行中发现:我已将“selenium-server-standalone-2.33.0.jar”添加到Java构建路径
你是否在该链接的代码之后立即遵循构造?它说你需要包括一些外部的罐子 – Neoh
我已经添加了所需的外部罐子 –