Firefox11.0中的Selenium 2错误
我是selenium 2的新手,我尝试运行一个简单的(下面的)示例,但当我使用Firefox 11.0时,我得到了一个窗口信息:[应用程序javascript]类型错误:Componenets;类别[cid]未定义 我有义务点击OK按钮查看我的脚本执行情况 我怎样才能解决这个问题Firefox11.0中的Selenium 2错误,firefox,selenium,webdriver,Firefox,Selenium,Webdriver,我是selenium 2的新手,我尝试运行一个简单的(下面的)示例,但当我使用Firefox 11.0时,我得到了一个窗口信息:[应用程序javascript]类型错误:Componenets;类别[cid]未定义 我有义务点击OK按钮查看我的脚本执行情况 我怎样才能解决这个问题 public class WhenSearchingForDrupalUsingGoogleTest { private String baseUrl; private WebDriver driver;
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));
}
}
}
使用GoogleTest搜索Rupal时的公共类{
私有字符串baseUrl;
私有网络驱动程序;
私人截屏助手截屏助手;
@以前
public void openBrowser(){
baseUrl=System.getProperty(“webdriver.base.url”);
驱动程序=新的FirefoxDriver();
get(baseUrl);
screenshotHelper=新的screenshotHelper();
}
@之后
public void SaveScreenshot和CloseBrowser()引发IOException{
screenshotHelper.saveScreenshot(“screenshot.png”);
driver.quit();
}
@试验
public void PageTitleafterSearch应以Drupal()开头引发IOException{
assertEquals(“页面标题在测试开始时应该等于Google。”,“Google”,driver.getTitle());
WebElement searchField=driver.findElement(By.name(“q”));
sendKeys(“Drupal!”);
searchField.submit();
assertTrue(“页面标题应以搜索后的搜索字符串开头。”,
(新的WebDriverWait(驱动程序,10))。直到(新的预期条件(){
公共布尔应用(WebDriver d){
返回d.getTitle().toLowerCase().startsWith(“drupal!”);
}
}));
}
私有类截屏助手{
public void保存截图(字符串screenshotFileName)引发IOException{
文件截图=((TakesScreenshot)driver.getScreenshotAs(OutputType.File);
copyFile(截图,新文件(截图文件名));
}
}
}
似乎是您的一个(或多个)加载项导致了问题。您是否尝试过该解决方案?您的一个(或多个)加载项似乎导致了该问题。您尝试过该解决方案吗?Firefox 11于2012年3月13日发布