我正在运行 android sdk for web driver 中给出的示例测试项目。代码是:
package simple.app.test;
import android.test.ActivityInstrumentationTestCase2;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.android.AndroidWebDriver;
import simple.app.SimpleAppActivity;
public class SimpleGoogleTest extends ActivityInstrumentationTestCase2<SimpleAppActivity> {
private WebDriver driver;
private WebDriver googledriver;
public SimpleGoogleTest() {
super("simple.app", SimpleAppActivity.class);
}
@Override
protected void setUp() throws Exception {
driver = new AndroidWebDriver(getActivity());
}
@Override
protected void tearDown() {
driver.quit();
}
public void testGoogleWorks() throws Exception {
driver.get("http://www.google.com");
Thread.sleep(10000);
WebElement searchBox = driver.findElement(By.name("q"));
searchBox.sendKeys("Android Rocks!");
searchBox.submit();
String title = driver.getTitle();
assertTrue("Got title: " + title, title.contains("Google"));
assertTrue(driver.findElements(By.partialLinkText("Android")).size() > 1);
}
}
我收到以下问题:
- Android2.2-NoSuchMethorError
- Android2.3.1-进程崩溃。
请帮我解决这些问题。