与Firefox 11.0的Selenium 2错误

时间:2012-03-15 10:25:44

标签: firefox selenium webdriver

我是selenium 2的新手,我尝试运行一个简单的(波纹管)例子,但是当我使用firefoxe 11.0时,我得到了一个窗口信息:[Application javascript] TypeError:Componenets; classes [cid] is undefined

并且我有义务单击“确定”按钮以查看我的脚本执行

我该如何解决这个问题?

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));
    }
  }
} 

2 个答案:

答案 0 :(得分:1)

Firefox 11于2012年3月13日发布

Selenium 2.20于2012年2月27日发布

考虑到这一点,你不能指望Selenium 2.20支持FireFox 11

目前支持的平台列表:

答案 1 :(得分:0)

似乎您的一个(或多个)附加组件导致了问题。您是否尝试过解决方案here