本文整理汇总了Java中org.openqa.selenium.remote.RemoteWebDriver.quit方法的典型用法代码示例。如果您正苦于以下问题:Java RemoteWebDriver.quit方法的具体用法?Java RemoteWebDriver.quit怎么用?Java RemoteWebDriver.quit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openqa.selenium.remote.RemoteWebDriver
的用法示例。
在下文中一共展示了RemoteWebDriver.quit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.openqa.selenium.remote.RemoteWebDriver; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
// Create a DesiredCapabilities object to request specific devices from the WebDriver server.
// A udid can be optionally specified, otherwise an arbitrary device is chosen.
DesiredCapabilities caps = new DesiredCapabilities();
// caps.setCapability("uuid", udid);
// Start a WebDriver session. The local machine has to be running the SafariDriverServer, or
// change localhost below to an IP running the SafariDriverServer.
driver = new RemoteWebDriver(new URL("http://localhost:5555/wd/hub"), caps);
// Connect to a URL
driver.get("http://www.google.com");
// Interact with the web page. In this example use case, the Webdriver API is used to find
// specific elements, test a google search and take a screenshot.
driver.findElement(By.id("hplogo"));
// Google New York
WebElement mobileSearchBox = driver.findElement(By.id("lst-ib"));
mobileSearchBox.sendKeys("New York");
WebElement searchBox;
try {
searchBox = driver.findElement(By.id("tsbb"));
} catch (NoSuchElementException e) {
searchBox = driver.findElement(By.name("btnG"));
}
searchBox.click();
takeScreenshot();
driver.navigate().refresh();
takeScreenshot();
// Quit the WebDriver instance on completion of the test.
driver.quit();
driver = null;
}