-3

i just opened Facebook with the help of Selenium:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class class1 {
    public static void main(String[] args) {

        System.setProperty("webdriver.gecko.driver","C:\\Users\\Hi\\Desktop\\selenium\\geckodriver.exe");

        WebDriver driver = new FirefoxDriver();
        driver.get("http://www.facebook.com");


    }

}

But on that site is no Firebug. When i open the browser normally without Selenium, then the Firebug icon is there. Can someone help?

Edit: Thanks to the help of yong. I also found a very good way to solve the problem with the help of this code i found here http://toolsqa.com/selenium-webdriver/custom-firefox-profile/

ProfilesIni profile = new ProfilesIni();
        FirefoxProfile myProfile = profile.getProfile("default");

        System.setProperty("webdriver.gecko.driver","C:\\Users\\Hi\\Desktop\\selenium\\geckodriver.exe");

        WebDriver driver = new FirefoxDriver(myProfile);
        driver.get("http://www.facebook.com");
Suppe
  • 189
  • 2
  • 5
  • 12
  • Possible duplicate of [How do I run Firebug within Selenium WebDriver (Selenium 2)?](https://stackoverflow.com/questions/3421793/how-do-i-run-firebug-within-selenium-webdriver-selenium-2) – JeffC Sep 15 '17 at 03:08

1 Answers1

1

Analysis:

Selenium use a default profile to open firefox, this profile not same as the one you open by manual. In general the default profile will not includes the plugins you istalled on firefox.

Solution

  1. Create a firefox profile manually,by default the newly profile will includes
    http://kb.mozillazine.org/Creating_a_new_Firefox_profile_on_Windows

  2. Tell selenium use the created profile when open firefox
    How to use custom Firefox Profile with Selenium? (Java) (And pass HTML Authorization Window)

yong
  • 13,357
  • 1
  • 16
  • 27
  • thanks yong! i got one question: i realized, that it is possible to open a second browser of the same page (but without Selenium) and use the Firebug to get the id or className of an element and add it to the code. Would you suggest this way or are there problems? – Suppe Sep 15 '17 at 02:21
  • 1
    no way, selenium need to obtain the control of browser at the beginning when launch browser, the browser you start withou selenium, selenium not has the power to control it. To learn more about the relationship between Selenium server/ Selenium Client API / Webdriver.exe / real browser, to find out the prodedure how is your script communicate to the browser. It wil help you to understand well the backgound of selenium and webdriver and your road on using selenium – yong Sep 15 '17 at 02:52
  • just one more comment. Your solution is good, but i think this solution of this video is better: https://www.youtube.com/watch?v=I6AaCvEgNmo With tis solution, you are able to use the "default" firefox including Firebug – Suppe Sep 16 '17 at 02:23