Tuesday, April 16, 2013

How to create selenium webdriver maven project

1.How to create selenium maven project.
2.run tests using maven project.
3.selenium grid setup and execute sample test case using grid.


1.How to create selenium maven project

step1: Down load eclipse kepler IDE from eclipse downloads

https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/kepler/SR1/eclipse-java-kepler-SR1-win32.zip

step 2: install maven and testng plugin from eclipse help--->install new software

               add below sites and install testng and maven

                TestNG - http://beust.com/eclipse

                Maven - http://download.jboss.org/jbosstools/updates/m2e-extensions/m2e-apt.
step 3:
create maven project in eclipse and add below depedency tags in pom.xml file.

step4: selenium maven dependency and testng maven dependency

<dependency>
  <groupId>org.testng</groupId>
  <artifactId>testng</artifactId>
  <version>6.1.1</version>
  <scope>test</scope>
</dependency>
  <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.37.1</version>
    </dependency>
  </dependencies>

step:4
right click on maven project and select maven--->update project option

update project will download latest testng and selenium jars in to .m2 folder in

example:C:\Users\Home\.m2

now you are ready to use your selenium maven project.

for reference you can use my maven project from git repository

https://github.com/naveenkumarks/selenium.git


Note :to download git project install git bash in your local pc

http://git-scm.com/download/win

After installation of git use below command to download selenium maven project.

step1: open git bash

step2: run below command in git bash

git clone https://github.com/naveenkumarks/selenium.git

your GIT bash screen will be like this.


import downloaded maven project

1.click file---->import from eclipse


2.select existing maven project

3.after import successful below screen will come to make sure you import successful




4.click finish and select maven project from eclispe and do right click and select
maven--->update project
5.after update .m2 folder will get all latest testng and selenium jar files.

i have explained two ways to create maven selenium project
1.import from existing maven project
2.create maven project from scratch.