Issue
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
?
Solution
With selenium-java dependency you get all java bindings for all browsers. So, you do not need to change anything in your pom from what you already have. The only thing that would change is your driver initialization code, which is driver = new FirefoxDriver() instead of OperaDriver.
Answered By - niharika_neo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.