Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

I would like to automate Firefox using Java through a Selenium WebDriver project.

As I never used Selenium nor Maven before I'm not familiar with how to set up a suitable Maven pom.xml file to create a project, which then can be imported into Eclipse.

On http://docs.seleniumhq.org/docs/03_webdriver.jsp#introducing-webdriver I found the following example for the Opera browser:

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"

             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>MySel20Proj</groupId>

    <artifactId>MySel20Proj</artifactId>

    <version>1.0</version>

    <dependencies>

        <dependency>

            <groupId>org.seleniumhq.selenium</groupId>

            <artifactId>selenium-java</artifactId>

            <version>2.28.0</version>

        </dependency>

        <dependency>

            <groupId>com.opera</groupId>

            <artifactId>operadriver</artifactId>

        </dependency>

    </dependencies>

    <dependencyManagement>

        <dependencies>

            <dependency>

                <groupId>com.opera</groupId>

                <artifactId>operadriver</artifactId>

                <version>1.1</version>

                <exclusions>

                    <exclusion>

                        <groupId>org.seleniumhq.selenium</groupId>

                        <artifactId>selenium-remote-driver</artifactId>

                    </exclusion>

                </exclusions>

            </dependency>

        </dependencies>

    </dependencyManagement>

</project>

Would you be so kind and show me how to adapt this pom.xml to apply for the Firefox browser, say Firefox 17?

1 Answer

0 votes
by (62.9k points)

To use only the FirefoxDriver implementation, you don't have to use the selenium-java artifact. Instead, you can simply add the dependency on the Firefox artifact. Add the following dependency to your pom.xml:

<dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-firefox-driver</artifactId> <version>3.0.1</version> </dependency>

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat Selenium certification

Related questions

0 votes
1 answer
0 votes
1 answer
asked Nov 20, 2019 in Java by Anvi (10.2k points)
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...