Я новичок с селеном 2, и я пытаюсь запустить простой (ниже) пример, но когда я использую Firefoxe 11.0, я получил информацию о окне: [Application javascript] TypeError: Componenets; классы [cid] не определены
и я обязан нажать кнопку ОК, чтобы увидеть выполнение моего скрипта
Как мне это исправить?
public class WhenSearchingForDrupalUsingGoogleTest {
private String baseUrl;
private WebDriver driver;
private ScreenshotHelper screenshotHelper;
@Before
public void openBrowser() {
baseUrl = System.getProperty("webdriver.base.url");
driver = new FirefoxDriver();
driver.get(baseUrl);
screenshotHelper = new ScreenshotHelper();
}
@After
public void saveScreenshotAndCloseBrowser() throws IOException {
screenshotHelper.saveScreenshot("screenshot.png");
driver.quit();
}
@Test
public void pageTitleAfterSearchShouldBeginWithDrupal() throws IOException {
assertEquals("The page title should equal Google at the start of the test.", "Google", driver.getTitle());
WebElement searchField = driver.findElement(By.name("q"));
searchField.sendKeys("Drupal!");
searchField.submit();
assertTrue("The page title should start with the search string after the search.",
(new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver d) {
return d.getTitle().toLowerCase().startsWith("drupal!");
}
}));
}
private class ScreenshotHelper {
public void saveScreenshot(String screenshotFileName) throws IOException {
File screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(screenshot, new File(screenshotFileName));
}
}
}