Reputation: 77121
What's the best way to activate Firebug in Firefox when running Selenium 2?
Edit: Ok, I realize "best" is open to interpretation, but the profile-based solution really used to be a pain with selenium 1.0. So any alternative is considered better until proved worse ;)
Upvotes: 26
Views: 23951
Reputation: 46
I have observed that the firebug is adding to browser and it is disabled by default and not enabled ,when i add firebug to firefox at runtime by using webdriver. So to make it enable we may need to add the below line to profile.
profile.setEnableNativeEvents(true);
Upvotes: 0
Reputation: 19
If none of the above option works. Then try this.
firefox -p
5) Now load this new profile via selenium , use below java statements.
ProfilesIni profile = new ProfilesIni();
FirefoxProfile ffprofile = profile.getProfile("SELENIUM");
WebDriver driver = new FirefoxDriver(ffprofile);
6) Done. Enjoy.
Upvotes: 0
Reputation: 8403
I found a profiles.ini in ~/.mozialla/firefox/. In there was a profile named default, which I specified a like the following and then firefox was opened in test just like I opened it regularly (with all plugins etc).
java -jar selenium.jar -Dwebdriver.firefox.profile=default
Upvotes: 0
Reputation: 29
modify your firefox location to something like C:\Users\user-name\AppData\Roaming\Mozilla\Firefox\Profiles\sgmqi7hy.default launch your firefox from selenium / webdriver make all your required settings close and restart firefox browser from selenium / webdriver that's it, it solves your problem !!
Upvotes: 0
Reputation: 17828
You can create your profile in code and dynamically add required add-ons. Let's assume that you saved Firebug XPI into the C:\FF_Profile folder as firebug.xpi (go to Firebug download page, right-click on the "Add To Firefox" and save as C:\FF_Profile\firebug.xpi).
In code:
final String firebugPath = "C:\\FF_Profile\\firebug.xpi";
FirefoxProfile profile = new FirefoxProfile();
profile.addExtension(new File(firebugPath));
// Add more if needed
WebDriver driver = new FirefoxDriver(profile);
This is described in WebDriver FAQ
Upvotes: 47
Reputation: 37746
Assuming that, Firebug is installed. Your objective is to run Firebug. Firebug can be run/execute by pressing F12 key. So Firebug can be run by following command of Selenium WebDriver with Java:
Actions action = new Actions(driver);
action.sendKeys(Keys.F12).build().perform();
Upvotes: -2
Reputation: 38462
Apparently the way the firefox-profile options are consumed has changed in Selenium WebDriver.
The old commandline (Selenium RC):
java -jar selenium-2.28.0.jar -firefoxProfileTemplate ~/.mozilla/firefox/3knu5vz0.selenium
Updated for WebDriver: (note that it wants the profile name rather than the directory)
java -jar selenium-2.28.0.jar -Dwebdriver.firefox.profile=selenium
Upvotes: 1
Reputation: 10396
Just reference your profile by name. Example in Ruby:
@driver = Selenium::WebDriver.for :firefox, :profile => "default"
Then, load Firefox normally, and add your desired extensions. They will now show up in your Selenium test runs.
Upvotes: 1
Reputation: 429
Do you mean having firebug installed in the browser instance that webdriver launches? If so, you can pass an extension when you instantiate the driver, but the eaisest way is to create a firefox profile with firebug installed and then use the following code before you instantiate the driver:
System.setProperty("webdriver.firefox.profile", "NAME_OF_FIREFOX_PROFILE_WITH_FIREBUG");
Upvotes: 10