Download Selenium Web Driver and J-Unit4 User Guide

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

URL redirection wikipedia , lookup

Transcript
Selenium Web Driver and
J-Unit configurations
Document
This Document Provides Instruction about setting a testing
Environment for Selenium Web driver and J-Unit 4.
1/15/2014
[Type the author name]
January 15, 2014
Contents
Setting up IDE:............................................................................................................................................... 2
Setting up Java Environment: ....................................................................................................................... 6
Selenium Web Driver Bindings: .................................................................................................................... 9
First Test Project: .......................................................................................................................................... 9
Good to Read Links: .................................................................................................................................... 11
1
Setting up IDE: | LMKT
January 15, 2014
Setting up IDE:
Installing Fire Fox Add-ons:
1. First download Mozilla Firefox browser.
2. Click on the Firefox tab present at the top the browser window.
3. In drop down menu click on Add-on.
2
Setting up IDE: | LMKT
January 15, 2014
4. Go to add on page of Mozilla Firefox browser. In the search box of Add on page search the term
"Selenium IDE" and press enter
5. A page will open which displays Selenium IDE add-on.
3
Setting up IDE: | LMKT
January 15, 2014
6. Click on install next to the Selenium IDE add-on
7. Once installation is done the Mozilla Firefox browser will ask you to restart the browser.
4
Setting up IDE: | LMKT
January 15, 2014
Validating Installation:
1. Open Tools Menu in Fire Fox Web Browser.
2. Verify Presence of “Selenium IDE”.
5
Setting up IDE: | LMKT
January 15, 2014
Setting up Java Environment:
Downloading and Installing JDK and JRE:
1. Download the latest version of the Java JDK from Sun Microsystems.
2. Double-click on the install file and it should open an installer.
6
Setting up Java Environment: | LMKT
January 15, 2014
3. Wait Until Installation Completes.
Setting Environment Variables for JVM:
1. Open the properties of "My Computer" by either right-clicking the icon on the desktop or
right-clicking Start > My Computer. When the pop up menu opens, scroll to the bottom and
select "Properties".
2. This should open a window named "System Properties". Click on the "Advanced" tab and then
click "Environment Variables"
7
Setting up Java Environment: | LMKT
January 15, 2014
3. Next, another window opens with a lot of confusing sentences and letters. Double-click on the
"Path" variable on either of the option boxes. It is recommended to edit the variable in the box
"User variables for (your username)
4. Once the variable is opened, a text box in yet another window appears. Careful not to delete
anything in this box. At the end of the text box, add a semi-colon if there is not one already, and
add "C:\Program Files\Java\jdk1.6.0\bin" to the text box. This is assuming you did not change
the file path of the installation.
5. Click "Apply" and "OK" to all the windows you have just opened. Open the command prompt
again, "java" command works then Environment Variable are correctly Set.
Downloading and Installing Eclipse:
1. Go to the Eclipse Downloads website , and the following webpage will open up.
2. Choose the appropriate version of Eclipse IDE for your operating system and Java installation.
 Look for "Eclipse IDE for Java Developers" and on its right hand side, there are two
versions of Eclipse available (32 bit and 64 bit).
 If you have 32 bit version of Java, choose 32 bit version of Eclipse and if your using 64bit Java, choose 64 bit version of Eclipse IDE
 If not sure about the configuration of your operating system, choose the 32 bit version
of Eclipse IDE as it works on both 32 bit operating system and 64 bit operating system
 Note: - It is important to choose the same version of Eclipse and Java because if you mix
32/64 bit Java/Eclipse then Eclipse might not work.
3. Once the right version selected, you will be directed to the mirror selection page:
 Proceed with the download by clicking on the Green arrow pointing downward.
 The download of eclipse-java-indigo-SR1-win32.zip will begin.
 Note: - Save the file to a convenient location like C:/ drive or Desktop.
 When the download finishes, proceed to the step 4.
4. Unzip the file: - The downloaded file will be a zipped folder, so in order to access its
contents we need to unzip the file as follows: Find the eclipse-java-indigo-SR1-win32.zip from where you saved it.
 Double click on it.
 The file will open with the default extraction wizard(i.e WinZip or WinRAR)
 Once the extraction/Unzipping is complete, you will be able to see a folder named
"eclipse".
5. Eclipse does not have any installer, that’s why we need to Run "eclipse", an application
within the eclipse folder as follows: Double Click on the eclipse folder.
 In the eclipse folder, look for an application named "eclipse"; it has a round
purple icon with white horizontal lines.
 Double click on it to run eclipse.
8
Setting up Java Environment: | LMKT
January 15, 2014
Selenium Web Driver Bindings:
Downloading Selenium Web Driver J-Unit Bindings:
1. Download Selenium Client & Web Driver Language Bindings from Selenium website.
2. Extract downloaded ZIP file to intended location (keep some permanent one, as you will
need them for a long time)
Using Web driver Bindings in J-Unit Project:
1. Create new Java project in Eclipse
2. Add all extracted JARs (also these in lib folder) to Java Build Path in project Properties
First Test Project:
Recording Test Script in IDE:
1. Open new tab in Mozilla Firefox browser.
2. Open selenium IDE.
3. Click on "Record" button. (Please note here. It will start recording all navigation and
action once you click on "Record" button.
4. Now enter URL "https://www.google.co.in/" in your browser. (Selenium IDE will record
that action. Make sure your recording is working fine.)
5. Click on "Images" link displayed in main menu.
6. Click on "Maps" link displayed in main menu.
7. Click on "Play" link displayed in main menu.
8. Stop Selenium IDE recording by clicking on "Stop Record" button. Your recording is
completed now.
9. My script will looks like bellow in selenium IDE.
New Test
Command
open
clickAndWait
assertTitle
clickAndWait
assertTitle
clickAndWait
assertTitle
9
Target
Value
https://www.google.co.in/
css=#gb_2 > span.gbts
Google Images
css=#gb_8 > span.gbts
Google Maps
css=#gb_78 > span.gbts
Google Play
Selenium Web Driver Bindings: | LMKT
January 15, 2014
Exporting IDE Test Script in Web Driver J-Unit:
1. After Recording Test case successfully. Open File From Menu.
2. And Export Test Case AS “Java/J Unit/ Web driver” file.
10
First Test Project: | LMKT
January 15, 2014
Creating Test Project in Eclipse:
1. Create new Java project in Eclipse
2. Add all extracted JARs (also these in lib folder) to Java Build Path in project Properties.
3. Add the Exported Code from Selenium IDE in Eclipse Project.
4. Click Run Button in mwnue.
Good to Read Links:
Selenium Web Driver Command Set:
http://docs.seleniumhq.org/docs/03_webdriver.jsp
Helpful Tutorials:
http://www.jroller.com/selenium/
http://www.qaautomation.net/?cat=7
http://www.vogella.com/tutorials/JUnit/article.html
http://thomassundberg.wordpress.com/2011/10/18/testing-a-web-application-with-selenium-2/
http://mestachs.wordpress.com/2012/08/13/selenium-best-practices/
11
Good to Read Links: | LMKT