How to use FireFoxDriver using Selenium 3 4 0 using Maven

0 votes

I'm using Selenium's v3.4.0 in a maven project. I imported all Selenium's jars using the below dependency:-


The issue is, I'm not able to resolve any dependency in my project in Eclipse for below code inside main method:-

public class FirefoxTest {

    public static void main(String[] args) {
        FirefoxOptions options = new FirefoxOptions();
        options.setBinary("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"); //This is the location where you have installed Firefox on your machine

        FirefoxDriver driver = new FirefoxDriver(options);

So, what could be wrong? Eclipse is unable to resolve FirefoxDriver type to any dependencies. Kindly help.

Apr 5, 2018 in Selenium by Martin
• 4,340 points
this is help full

Hi @Vaishali, thank you for your contribution to the Edureka Community.

Register/Sign up on the community to gain points for further contributions. You may ask questions, answer, upvote an answer. Each of these would fetch you points and you could be among the top contributors and win exciting merchandise from Edureka.


1 answer to this question.

0 votes

Your using the wrong functions to set the browser property. Use set.SystemProperty() and WebDriver() functions instead. Look at the below code to understand.

System.out.println("Welcome to Maven World");
System.setProperty("webdriver.gecko.driver", "C:\\Utility\\BrowserDrivers\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();       

And also run the commands to flush out previous dependencies, to install the new dependencies & execute your test:

>mvn clean
>mvn install
>mvn test 

This should work.

answered Apr 5, 2018 by nsv999
• 5,500 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer

How to use css selector in selenium using Java?

Hello @Jino, CSS Selector is pretty easy to ...READ MORE

answered Dec 21, 2018 in Selenium by Nabarupa
0 votes
0 answers
0 votes
2 answers

How to use Selenium with Python?

Hey Shubham, you can checkout this thread ...READ MORE

answered Aug 26, 2019 in Selenium by Abha
• 28,040 points
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
0 votes
1 answer
+1 vote
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,500 points