0 votes
1 view
in Devops and Agile by (24.5k 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.1k 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>

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...