3

I can't seem to figure out why my Firebug extension shows that its disabled when I try to click on it within the Firefox WebDriver.

Here's what my code looks like, I got some of the code from this SO answer:

private final String firefoxExtPath = "/Users/[NAME]/Library/Application Support/Firefox/Profiles/4izeq9he.default/extensions/";
private final String firebugPath = firefoxExtPath + "firebug@software.joehewitt.com.xpi";
private final String firepathPath = firefoxExtPath + "FireXPath@pierre.tholence.com.xpi";

private WebDriver dummy;
private WebDriver driver;
...

@BeforeClass
public void addFirefoxExt() {
    // Add extensions to FirefoxDriver
    FirefoxProfile profile = new FirefoxProfile();
    try {
        profile.addExtension(new File(firebugPath));
        profile.addExtension(new File(firepathPath));

        profile.setPreference("extensions.firebug.currentVersion", "1.11.1");
        profile.setPreference("extensions.firebug.onByDefault", true);
        profile.setPreference("extensions.firebug.defaultPanelName", "net");
        profile.setPreference("extensions.firebug.net.enableSites", true);
    } catch (IOException e) {
        e.printStackTrace();
    }

    dummy = new FirefoxDriver(profile);
    driver = new FirefoxDriver(profile);
}

@BeforeClass
public void setup() {
    dummy.get(BASE_URL);
    dummy.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    ...
}
4

1 回答 1

0

这就是我可以从https://code.google.com/p/selenium/wiki/FirefoxDriver得到的。他们工作得很好。

与萤火虫一起运行

Download the firebug xpi file from mozilla and start the profile as follows:

File file = new File("firebug-1.8.1.xpi");
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.addExtension(file);
firefoxProfile.setPreference("extensions.firebug.currentVersion", "1.8.1"); 
// Avoid startup screen

WebDriver driver = new FirefoxDriver(firefoxProfile);
于 2013-09-27T06:32:52.907 回答