权限被拒绝:连接发生在Selenium 2.44.0上

时间:2015-03-01 15:02:57

标签: java selenium selenium-firefoxdriver

我正在使用Selenium 2.44.0测试我的Web项目,但每当我运行程序时,它只是停止测试然后抛出错误说:

http://i.stack.imgur.com/bFoSF.png

启动浏览器的代码是:

try {
    ff.setPreference("permissions.default.image", 2);
    driver = new FirefoxDriver(ff);
    driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
    driver.manage().window().maximize();
    driver.get(baseUrl);
} catch(Exception e) {
    e.printStackTrace();
    JOptionPane.showMessageDialog(null, "Your browser is failing. A quick fix to this problem is to download and install Firefox 28.", "Oppss..", JOptionPane.ERROR_MESSAGE);
}

有没有办法解决这个错误?我没有使用selenium-server-standalone,我使用了selenium-java。我是否需要从使用selenium-java切换到selenium-server-standalone?

1 个答案:

答案 0 :(得分:1)

看起来你遇到了selenium 2.44和Firefox 35 之间的兼容性问题:升级到selenium 2.45 ,这是几天前发布的,或者降级你的Firefox到34.0.5