我新與硒2,我嘗試運行一個簡單的(波紋管)例外,但是當我使用firefoxe 11.0我有一個窗口信息:[應用程序JavaScript] TypeError:Componenets;類[西德]未定義硒2錯誤與Firefox 11.0
,我有義務單擊確定按鈕來查看我的腳本執行
我怎麼能定勢呢?
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));
}
}
}
是我已經做到了,但不工作! – user1271229 2012-03-16 08:15:26