0

I'm trying to launch a Firefox profile with add-ons in it, with selenium v3.12 and gecko-driver v2.10 and Firefox version 60.0, how-ever it seems that the custom profile is not working. below is my code

  static WebDriver driver;
    ProfilesIni profile = new ProfilesIni();
            myprofile = profile.getProfile("AutoProfile");
    System.setProperty("webdriver.gecko.driver", 
      "E:\\Library\\geckodriver-v0.21.0-win32\\geckodriver.exe");
            driver = new FirefoxDriver(myprofile);

The acutal error is on the

     driver = new FirefoxDriver(myprofile);

as

The constructor FirefoxDriver(FirefoxProfile) is undefined

  • Are you using maven? If yes, can you post your dependencies? – Alexey R. Aug 3 '18 at 9:17
0

Try this below line

WebDriver driver = new FirefoxDriver(myProfile);
0

In the code you need to initialize Firefox profile with the object of myprofile.

ProfilesIni profile = new ProfilesIni();
       FirefoxProfile myprofile = profile.getProfile("AutoProfile");
    System.setProperty("webdriver.gecko.driver", 
      "E:\\Library\\geckodriver-v0.21.0-win32\\geckodriver.exe");
         WebDriver driver = new FirefoxDriver(myprofile);

Also It's a bad practise to declare the WebDriver as static. Please refer the following link for more information.

  • I tried above, still same error occurs – Prasad_Joshi Aug 3 '18 at 7:12
  • Check the geckodriver path and update it correctly. – Prasanna venkatesh Aug 3 '18 at 7:18
0

Try below code, it worked for me:

    System.setProperty("webdriver.gecko.driver", "Path of geckodriver.exe on your machine");

    ProfilesIni profile = new ProfilesIni();

    FirefoxProfile myprofile = profile.getProfile("Your Firefox Profile name");

    FirefoxOptions options=new FirefoxOptions().setProfile(myprofile);

    WebDriver driver=new FirefoxDriver(options);

    driver.get("Your application URL");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.