1

I am trying to import Firefox on my project, but it's not importing at all, even though I have downgraded selenium version as well. I am using following selenium maven dependency:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.4.0</version>
</dependency>

Whenever I am trying to import FireFoxOptions. It is showing red colour text, I need to know, if I am making any mistake.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

2 Answers2

1

The Selenium maven dependency is perfect.

<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.4.0</version>
</dependency>

This usecase

Instead of importing FireFoxOptions you should have imported FirefoxOptions. A demonstration:

  • Code block:

    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.firefox.FirefoxOptions;
    
    public class genericTestFirefox {
    
      public static void main(String[] args) {
    
          FirefoxOptions options = new FirefoxOptions();
          options.setBinary("C:\\Program Files\\Mozilla Firefox\\firefox.exe");
          WebDriver driver = new FirefoxDriver();
          driver.get("https://www.google.com/");
      }
    }
    
  • Browser snapshot:

Firefox

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
0

First: Can you work with the webdrivemanager ? It will help you in your configuration of selenium with firefox.

Second: To use Firefox option (eg: maximize your Window) use this exemple:

// Create an instance of FirefoxOptions
FirefoxOptions options = new FirefoxOptions();

// Maximize the Firefox window
options.addArguments("--start-maximized");

// Create an instance of Firefox with the options applied
WebDriver driver = new FirefoxDriver(options);

I hope it helps you !

Alex
  • 3
  • 1