2 回答
TA贡献1934条经验 获得超2个赞
你应该先初始化它:
try {
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();
} catch (Exception e) {
e.printStackTrace();
}
TA贡献1865条经验 获得超7个赞
AndroidDriver driver = new AndroidDriver(new URL("localhost:4723/wd/hub"), cap); 这应该是类或本地可访问性。声明为类对象,即在此文本夹具中或在由该类继承的父类中或在本地初始化,即在测试方法中。
添加回答
举报