The constructor FirefoxDriver(FirefoxProfile) is undefined

1,800 views
Skip to first unread message

mlong...@gmail.com

unread,
Oct 4, 2017, 10:17:29 PM10/4/17
to Selenium Users
I'm new to Selenium but have been able to get what I'm trying to accomplish working except one this, loading a profile. Im working with the Firefox Webdriver using Eclipse IDE. I'm opening a few pages in different tabs and logging in. What I need is to have an extension "Tab rotator" to rotate through the tabs after the script runs. I did some searching and found pretty much the same answer 10 times but It's not working for me. I have provided an example below, The issue is on "new FirefoxDriver(myprofile)". I receive the error "The constructor FirefoxDriver(FirefoxProfile) is undefined" I'm using the Java 3.6 webdriver .jars. I'm not sure if this may be deprecated or if i'm just completely missing something.

package base;
import org.openqa.selenium.*;
import org.openqa.selenium.ie.*;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.util.*;
import java.io.*;
public class Class1 {

public static void main(String[] args) {
//FirefoxOptions options = new FirefoxOptions();
//options.addPreference("browser.tabs.remote.autostart.2", false);
//firefoxprofile.addExtension(addonpath);
//WebDriver driver = new FirefoxDriver(options);
ProfilesIni profile = new ProfilesIni();
FirefoxProfile myprofile = profile.getProfile("ISTSDashboard");
WebDriver driver = new FirefoxDriver(myprofile);
driver.get("https://www.google.com");


Krishnan Mahadevan

unread,
Oct 4, 2017, 10:22:52 PM10/4/17
to seleniu...@googlegroups.com

You should be doing something like this :

 

public static void main(String[] args) {
    FirefoxOptions options =
new FirefoxOptions();
    options.setProfile(getProfile(
"myprofile"));
    FirefoxDriver driver =
new FirefoxDriver(options);
}

private static FirefoxProfile getProfile(String profileName) {
   
if (profileName == null || profileName.trim().isEmpty()) {
       
return new FirefoxProfile();
    }
   
return new ProfilesIni().getProfile(profileName);
}

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/60f13393-fb11-45ec-bae8-6acd404d978a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages