TESTEROPS

A pragmatic approach to QA and OPS

Installation -Ubuntu 14.04 LTS – Eclipse

Previously we saw how we’re going to install Selenium with Eclipse and Java in Windows. Now we are going to see how we’re gonna do that in Lunix, particularly in Ubuntu 14.04.

The per-requisite for installing Selenium and Eclipse is that you should have the Java run time environment or simply Java on your system.

So, first step would be to check if Java is installed on your system. Run this command-

Now, depending on whether you have Java installed on not, you can proceed. If your system does has Java, you need to jump to the section where we are installing Eclipse, otherwise, we need to install Java first. Run either of these two commands

$ sudo apt-get install openjdk-7-jre

OR

$ sudo apt-get install openjdk-7-jdk

Installing Eclipse

Next step would be to install Eclipse for the Ubuntu machine. Head over to this link for downloading Eclipse.

Move the downloaded package to /opt/ folder

$sudo mv Downloads/eclipse-* /opt/

Now move to your /opt/ directory and then move extract the files
cd /opt/
sudo tar -xvf eclipse-xxx.tar.gz

You now need to create a desktop file called “eclipse.desktop” in /usr/share/applications. Open your default editor (like gedit) and create this file
$ sudo gedit /usr/share/applications/eclipse.desktop

In the file that opens up, copy the following

[Desktop Entry]
Name=Eclipse 
Type=Application
Exec=/opt/eclipse/eclipse
Terminal=false
Icon=/opt/eclipse/icon.xpm
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE;
Name[en]=eclipse.desktop

This should install Eclipse correctly on your system. But in order to start this you would need to search in the Unity launcher and then run. You need to add a few additional commands if you want to run the Eclipse directly from Unity.

sudo desktop-file-install /usr/share/applications/eclipse.desktop

Create a symlink in /usr/local/bin

cd /usr/local/bin

sudo ls -s /opt/eclipse/eclipse

If you want the Eclipse icon to be displayed in Unity dash, you would want to run this

sudo cp /opt/eclipse/icon.xpm /usr/share/pixmaps/eclipse.xpm


Installing Selenium

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.
  • 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.

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

Integrating Selenium in your project

Now comes the part where you can integrate Selenium in your Java project. This is same as the Windows part.

  • 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 downloads folder. You need to go to the location where you have downloaded and extracted the Selenium jar files.

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

  • 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 integrated in your project. Now we go ahead and run a simple program to test if our set up is working.

2 thoughts on “Installation -Ubuntu 14.04 LTS – Eclipse

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 )

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.

%d bloggers like this: