Quality Matters

Blog - The art of Software QA and Testing

Installing Maven + Selenium WebDriver

{ 01:32, 9/5/2012 } { Posted in Automation } { 0 comments } { Link }
I know there are many tutorials on the net about Maven + Selenium installation, but I couldn't find any tutorial that describe the installation procedures step by step from the beginning to the end. So I decide to create one myself:

1.Download & Install JDK from here:
http://www.oracle.com/technetwork/java/javase/downloads/index.html

Remember, must be JDK, JRE alone is not enough.

 

2.Eclipse + m2eclipse plugin

Download the latest version of Eclipse: (Eclipse-Indigo)
http://www.eclipse.org/downloads/

m2eclipse is included in the latest version of Eclipse-Indigo already.  If you want to update m2eclipse or if you are using a previous version of Eclipse (e.g: Helios) then you have to download/update it via Help>Eclipse Marketplace>download "Maven Integration for Eclipse".

 

3. Download & Installing Maven:

http://maven.apache.org/download.html (Choose Maven 3.0.4 (Binary zip)

Extract it to C:Program Filesapache-maven-3.0.4

Set Environment Variables : (Right click my computer>Properties>Advanced>Environment Variables)
Create THREE "New" System Variable
1st:
-Variable Name: JAVA_HOME
-Variable Value: "C:Program FilesJavajdk1.7.0_01"  (Without quote). "JDK folder".

2nd:
-Variable Name: M2_HOME
-Variable Value: "C:Program Filesapache-maven-3.0.4"  (Without quote). "Maven folder"

3rd:
-Variable Name: M2
-Variable Value: "%M2_HOME%in" (Without quote)

Edit "Path " System Variable : (By appending the "%M2%;" the beginning of the string)
-Variable value (BEFORE): "C:Windowssystem32;C:Windows…."
-Variable value (AFTER): " %M2%; C:Windowssystem32;C:Windows…."

Test it!:
Open Command Prompt and enter: "mvn -version" something like this should appeared:

Congratulation, Maven has been installed successfully!

 

4. Run your project in Eclipse.

1st step:
Open Eclipse, Go to File>New>Project>Select "Maven Project".
Click Next>Next(default value)>
Group ID: Your Company Name  
Artifact ID: Your Porject Name
Click Finish

2nd step:
Edit "pom.xml"

Under

<dependency> you can change  the junit version to the latest version


Add dependency for selenium: e.g:

<dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>2.21.0</version> </dependency>

Please refer to the selenium website for the latest version:
http://seleniumhq.org/download/maven.html

Save file

 

3rd Step:.
Create java class file (our test code is here)

Under src/test/java and your package, you can create a new java class file called: "Selenium2Example.java".

Copy paste the code from main selenium tutorial website:

http://seleniumhq.org/docs/03_webdriver.html

Run it (Press the green arrow button) et voila!

 




{ Last Page } { Page 2 of 6 } { Next Page }

About Me

Home
My Profile
Archives
Friends
My Photo Album

«  May 2013  »
MonTueWedThuFriSatSun
 12345
6789101112
13141516171819
20212223242526
2728293031 

Links

AST
Weekend Testing
Software Testing Club
SQAForums
James Bach's Blog

Categories

Software Testing
Automation

Recent Entries

Moved...
Installing Maven + Selenium WebDriver
Sympathetic Testing
Differences between Quality Assurance and Quality Control
Tips for passing the ISTQB Foundation Level exam - Do's and Don't's

Friends