Installation -Windows 7 using Eclipse

In the previous page, we learnt how to install Selenium IDE plugin our Firefox browser. Now let us take a look at another component of the Selenium Suite- the most powerful one- Selenium Webdriver.

Selenium Webdriver allows you to  control the browser interactions- using various methods , which we generally call as API’s.  The best thing about Webdriver is that is gives the freedom to control and mimic almost all kinds of user interactions, in the best possible way and without the restriction of a programming language.  Selenium Webdriver bindings are available for Java, Perl, Python, Groovy, C#, Ruby etc.

Here I would be demonstrating how we would use an IDE- like Eclipse and set- up Selenium Webdriver set up for Java language using the Java API’s.

selenium-webdriver-architecture

The first thing we would like to install is an IDE like Eclipse – I am basing this on the assumption that you know what Java is and have a fair amount of idea about it. That is why I have skipped the Java installation part.

Installing Eclipse IDE

  • Open up your web browser and search for Eclipse or simple Google -“Eclipse Download. Click on the link which comes up in the search.

eclipse1

  • Once you open up the Eclipse download page, you will see a lot of options for download. Do not select the Eclipsee IDE for Java EE developers. That is the most common mistake that I have seen people do. Select the first option (it will be for Eclipse Luna). Select the version- 32-bit or 64-bit version according to your OS configuration.

eclipse2

  • Eclipse download page gives you the option to select the download mirror. You needn’t change anything here. Just click on the green button and the download will start.

eclipse3

  • Thank You page comes up. Your download will start shortly.

eclipse4

  • Once the download completes, you’ll see the .rar file of the Eclipse downloaded in your system.

eclipse5

  • Extract this file in the same folder. Open the folder. You will see these things in the folder.

eclipse7

  • Click on the Eclipse icon. It will ask you for the Workspace location, where it will store and keep all your program files. If you don’t have Java installed on your system, then Eclipse will throw an error, before opening up the workspace location. So make sure you have Java installed.

configure_eclipse_1b

Once you click the Ok button. Eclipse will take a minute to set up everything and then the IDE window comes up. This completes the installation of Eclipse IDE on your system.

Downloading Selenium Jar Files

We need the selenium jar files, which will allow us to use the powerful features of Webdriver API. Since our choice of language is Java, we need to download the JAR files, from Selenium home page.

  • Open your browser and search “Selenium installation” in search box.

webd1

  • We download the Java implementation. Click on the link. The jar files will start downloading. It’s around 23-24 MB in size. Allow it to download.

wed2

  • Once the download completes, you’ll see the .rar files for Selenium 2.44.0 in your download folder. Extract the into the target folder you want. You can extract in the same driver as well. It doesn’t matter. wed3web4

We have now downloaded and extracted Selenium jar files in our system. Now we need to integrate Selenium in our project in Eclipse.  Open up the Eclipse window.

  • Open the Eclipse window. Go to top left hand corner and go to File -> New -> Project

webd5

  • Select “Java Project” from the options that comes up in the next window.

web6

  • Enter a name for your project. Leave all other things untouched here. No need to change anything. Keep them as they are by default. Click on Next button here.

web7

  • In the next window, you needn’t do anything. Just click the FINISH button.

web8

  • Pressing the FINISH button creates a new entry in the Package Explorer section of the window. It should be showing a new entry with the name you chose for your project.

web9

If you click the “+” sign, it will be something like this.

web10

Your project has been created. Now we need to add Selenium jar files to this project.

  Adding Selenium To Your Project

Now that we have downloaded Eclipse, created a project and downloaded Selenium jar files, it’s time for us to add these jar files to our created project.

  • Go to the Project folder and right click on the “src” folder. Out of the various options available, go to Build Path.

eclipse8

  • Once you go to Build Path, another menu opens up. Now select Configure Build Path from those options.

eclipse9

  • The java Build Path opens up. You will see four different tabs. Now Select Libraries tab from those tabs.

eclipse10

  • Go to Add External Jars button. Since Selenium doesn’t comes embedded into eclipse, we need to add those external jars manually here, in our project build path.

eclipse11

  • This will take you to the download folder in C. You need to go to the location where you have downloaded and extracted the Selenium jar files. For me it is C:/Downloads/Compressed.

eclipse12

  • Search for Selenium 2.44.0 folder. And open it. You’ll see two files in that folder. Select those two files and click on Open.

eclipse13

  • Clicking Open will add those two files in the Java Build Path.

eclipse14

  • Now go back to the Add External Jars button. Click again. This time click on the lib folder present.

eclipse15

  • You will see a lot of jar files here. Press Ctrl+A and select all the files. Click Open.

eclipse16

  • All the selected files are now added in the Java Build Path. This completes adding the Selenium jar files to your project.

eclipse17

  • In the Package Explorer, you will see Referenced Libraries. Click on the “+” sign.

eclipse18

  • All the added Selenium files are shown in this folder. This means you have successfully added the Selenium jar files in the Project. Now you will be able to use the Selenium API in your programs.

eclipse19

Selenium is now added to your project. Let us start by writing few programs. Click here for a simple sample code.is

This installation is for Windows systems. And uses Java as programming language. Now a days, Python is increasingly gaining popularity among testers for use in Selenium. Check this for a instructions on how to use Selenium with Python on a linux machine.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.