18 Nov 2016

Environment Setup for Selenium2.0 WebDriver

6:12 PM Selenium 0 Comment

Selenium :
Selenium is a software testing framework for web Applications.

Softwares Required :
1. Install jdk1.7 in the System.
2. Install mozilla firefox Browser – version -40.0 (recommended)
After installing the firefox browser, change the default setting of automatic update.
Otherwise, later you may face the issue that browser not supported  while executing the
Selenium scripts.
To change the default automatic update for firefox browser, follow the below screenshots.
click on the red(higllighted) visible on screenshots, it might be content or icons.
f1

f2

f3

f4

To check the firefox version, follow the belowscreenshots.
click on the red(higllighted) visible on screenshots, it might be content or icons.

s21

s22

s23
2. Install eclipse-kepler IDE, from the below link.

3. No need of downloading the selenium jar file, just add the dependency in the pom.xml.
open the eclipse, create a maven project. To do so follow the below screenshots.
click on the red(higllighted) visible on screenshots, it might be content or icons.

s11

s12

s13

s14

s15

s16

s17

now add the dependency as shown in below screenshot.

s18

s19

Program : 
Now let us write a program to open gmail page ( http://www.gmail.com ) with firefox browser.
now copy paste the below selenium code in the App.java file and execute it.

You will get the below screenshot as the output.

fi

By default selenium supports firefox browser, but if You want to work with Chrome browser
download the .exe file from the below link.

d1

d2

d3

select any link from below (for example I shown one link, but  you can select any link and verify) and check the notes.txt file, for chrome browser support,  that which version you have  already installed in your System.
d4

d5

d6

To Download the .exe file for chrome ( it is  platform dependent ), So for both windows 32/ 64 bit, click on ChromeDriver_win32.zip. 
d7

After downloading the .exe file, open the eclipse and follow the same procedure as above (which we followed with firefox browser).

Program : 
Now let us write a program to open gmail page ( http://www.gmail.com ) with chrome browser.
now copy paste the below selenium code in the App.java file and execute it.

And also don’t forget to add the .exe file location of your system in the below code.

You will get the below screenshot as the output.

d8

Below is the link of Selenium API, you can explore more with it.

 

you have successfully executed the Selenium script with both firefox and chrome Browsers.

Leave a Reply