我想运行相同的测试代码:
例如
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("mysql excel 2013");
element.submit();
// Check the title of the page
System.out.println("Page title is: " + driver.getTitle());
// Google's search is rendered dynamically with JavaScript.
// Wait for the page to load, timeout after 10 seconds
(new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver d) {
return d.getTitle().toLowerCase().startsWith("mysql");
}
});
// Should see: "cheese! - Google Search"
System.out.println("Page title is: " + driver.getTitle());
// Close the browser
具有不同的能力配置
DesiredCapabilities capability = DesiredCapabilities.firefox();
capability.setVersion("15");
capability.setCapability("flash", "11-4");
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://192.168.1.22:4444/wd/hub"), capability);
铬合金
DesiredCapabilities capability = DesiredCapabilities.chrome();
capability.setVersion("21");
capability.setCapability("flash", "11-4");
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://192.168.1.22:4444/wd/hub"), capability);
在不创建具有不同功能的多个实例的情况下,最好的方法是什么?Selenium 是否为此提供了一个概念?
还是我会“简单地”使用某种循环结构来循环?