我一直按照以下说明操作:
http://code.google.com/p/selenium/wiki/AndroidDriver
到目前为止,我已经成功完成了以下工作:
使用javac编译,我不知道这是否正确:
javac -classpath c:_projects \ _junit \ _junit-4.10.jar; c:_projects \ selenium-java \ selenium-java-2.17.0.jar OneTest.java
这是我的测试:
import junit.framework.TestCase;
import org.openqa.selenium.WebDriver; //VERY IMPORTANT. This line is not in the example on the Selenium AndroidDriver website.
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();
}
}
现在我被困在这个部分: http://code.google.com/p/selenium/wiki/AndroidDriver#Build_the_Android_Code
我在哪里运行这些命令?例如$。/ go android_client等。我想我只需要知道如何正确编译以及如何将此测试转发给模拟器。但我可能完全走错了路。
我的版本是:
答案 0 :(得分:1)
记住你到目前为止采取的步骤和摘录:
现在我被困在这个部分: http://code.google.com/p/selenium/wiki/AndroidDriver#Build_the_Android_Code
我在哪里运行这些命令?例如$。/ go android_client等
该部分用于构建Andriod WebDriver代码。我建议您不要尝试运行这些命令,因为不需要该部分来运行测试,这是您从下面的摘录中收集的意图:
我想我只需要知道如何正确编译以及如何编译 将此测试转发给模拟器。但我可能完全错了 轨道。
基本上你已经完成了所有的基础工作,此时你需要做的就是运行测试文件。
你可以尝试:
有关在Eclipse here上启动和运行的一些有用信息。假设您正在运行Eclipse(Junit已经插入了eclipse),您可以在Eclipse的Package Explorer窗口中右键单击您的测试文件,然后单击Run As> Junit测试。
希望这有帮助。