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:-

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.4.0</version>
</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);
        driver.get("http://www.google.com");
    }
}

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

Apr 6, 2018 in Selenium by Martin
• 4,320 points
4,993 views
this is help full

Thanks
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.

Cheers!

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();       
driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
driver.navigate().to("http://www.google.com");

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 6, 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
1,286 views
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,140 points
1,198 views
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
13,674 views
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
9,143 views
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,910 points
7,221 views
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
8,359 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP