无法将Firefox加载项添加到Selenium WebDriver

时间:2013-07-28 05:14:55

标签: java firefox-addon selenium-webdriver

我正在尝试将附加组件“InvisiblieHand”添加到Selenium Firefox WebDriver中。我知道我的代码是正确的,因为它适用于其他附加组件,如firebug。我想知道是否有任何其他方法可以将此添加到WebDriver,以了解为什么这不适用于我的附加组件。我正在使用JAVA执行此操作。

File file = new File("invisiblehand-3.8.28-fx.xpi");
    FirefoxProfile firefoxProfile = new FirefoxProfile();
    try {
        firefoxProfile.addExtension(file);
    } catch (Exception e) {
        e.printStackTrace();
    }

    WebDriver driver = new FirefoxDriver(firefoxProfile);

由于

1 个答案:

答案 0 :(得分:0)

你启用了扩展吗?大多数firefox扩展需要重新打开firefox才能启用它。

当您重新打开Firefox时,它将再次打开一个新的隐身窗口。所以你必须找到一个替代解决方案。