0
votes

I need your help to set up my Firefox profile with Firebug. What I'd like to have is to have the Firebug add-on to be loaded with the Firefox instance when I start it via Selenium WebDriver. Here is sample of my code:

final File file = new File("C:\\Program Files (x86)\\Gecko\\bin\\geckodriver.exe");
System.setProperty("webdriver.gecko.driver", file.getAbsolutePath());
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("?"); 

So... how can I set the setPreference value, so that Firebug is loaded together with Firefox when the Selenium WebDriver starts the browser?

2
Kotoj.. Thanks a lot for following up with my in quires. Here is the code: final File file = new File("C:\\Program Files (x86)\\Gecko\\bin\\geckodriver.exe"); System.setProperty("webdriver.gecko.driver", file.getAbsolutePath()); final String firebugPath= "C:\\Users\\jnguyen\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\erx927l4.default\\extensions\\[email protected]"; FirefoxProfile profile = new FirefoxProfile() ;profile.addExtension(new File(firebugPath)); driver = new FirefoxDriver(profile); - know-nada

2 Answers

0
votes

You have to add the extension instead of setting the preference:

final String firebugPath = "C:\\FF_Profile\\firebug.xpi";
FirefoxProfile profile = new FirefoxProfile();           
profile.addExtension(new File(firebugPath));   
WebDriver driver = new FirefoxDriver(profile);

You can find the Firebug path following this instructions:

https://stackoverflow.com/a/8074828/432681

0
votes

Kotoj

Here is the code:

// Tell cucumber where the geckodriver is located in your environment

final File file = new File("C:\\Program Files (x86)\\Gecko\\bin\\geckodriver.exe");


// Get the absolute path to the Gecko Driver
System.setProperty("webdriver.gecko.driver", file.getAbsolutePath());


final String firebugPath= "C:\\Users\\<My username>\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\erx927l4.default\\extension s\\[email protected]";


// Set up the Firefox browser profile
FirefoxProfile profile = new FirefoxProfile();


profile.addExtension(new File(firebugPath)); 


// bring up the browser
driver = new FirefoxDriver(profile);

I tried to add these codes to the comments section but it won't let me format the text so I have to post them in the "Post Your Answer" section.. sorry