In order to develop scripts in Selenium with java you need to ensure that your computer have the initial configuration done. Setting up environment of Selenium with Java includes following steps.
- Download and install JDK (Java development Kit).
- Download and configure Eclipse.
- Configure firebug and FirePath.
- Configure WebDriver.
Downloading and Installing JDK (Java Development Kit)
JDK is the acronym for Java Development Kit. In order to run java JDK is required in your system. Lets learn how to download and install it in your computer.
Step 1:
Navigate to
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Step 2:
Download java JDK. For reference ‘Installation notes’ are also provided besides the download button.
Step 3:
Accept the required licence and select the appropriate installation. For an instance, if you are using ‘Windows 7 64 bits’ select the appropriate link and save the .exe file to your drive.
Step 4:
Run the downloaded exe file to launch installation wizard. Click ‘Next’ to continue. On next step select ‘Development Tool’ and again click ‘Next’. A progress bar will show you the file extraction status for JDK. After that step just choose the desired drive to install and click ‘Next’. The installer now will start installing JDK to your computer drive.
Step 5:
After successful installation of your JDK you can cross verify whether JDK have successfully installed in your computer or not. For this verification just go to ‘Run’ window and write ‘cmd’ (Without quotes) and press enter. This will open command prompt on your computer screen.
Just write ‘java’ (Without quotes) in command prompt and press enter. If java is not successfully installed on your computer then it will respond as ‘Unknown Command’. If java has been successfully installed in your computer then the following screen will be appear.
Download and configure Eclipse.
Step 1:
For downloading eclipse /navigate to
http://www.eclipse.org/downloads/
Download appropriate installer on the basses of your operating system.
Step 2:
A zipped file is downloaded in your drive. Unzip that file contents.
Step 3:
After unzipping the file contents you will see different files in that folder. Search for ‘Eclipse.exe’ and double click open Eclipse.
Step 4:
Eclipse will ask for selecting the workspace. Workspace means the location of your computer to which you want to store the developed scripts. Select the determined location and click ‘OK’.
Step 6:
A welcome window for Eclipse will be opened as following. Congratulation..! you have successfully installed Eclipse.
Configure FirePath
To work with Selenium WebDriver, we require locators. We need to locate different web elements based on their XPaths, name, ID, Class etc. this can be located with the help of plugins/tools. We have already installed Firebug add-on while learning Selenium IDE. Now it’s time to use that add-on.
Step 1:
In order to get grab ‘XPaths’ of web elements you need to install FirePath. FirePath works within FireBug. You can install firePath by navigating to
https://addons.mozilla.org/en-US/firefox/addon/firepath/"
Step 2:
Now, launch ‘FireBug’ from “Tools” -> “Web Developer” -> “FireBug”. You will see FirePath tab which you have recently installed.
Now let us understand how these things actually work. For demo, we will use ‘www.google.com’ and grab out the properties of search engine textbox.
1. First, click on locate element icon highlighted in below image and drag it to the Google’s textbox (element of which we want to grab properties). The HTML/DOM of the object would be displayed. We are now able to grab the properties of the input text box with which we can interact.
2. To grab the ‘XPath’ for any web element just go to FirePath tab and perform following steps:
a. Click Locate element icon.
b. Select web element for which you want to grab ‘XPath’.
c. XPath for selected web element will be generated.
Configure Selenium WebDriver
We are now coming closer to real implementation of Selenium. Let us learn how to configure Selenium WebDriver on to your computer. We will learn how to develop Selenium script using WebDriver in further articles.
Step 1:
For configuring Selenium WebDriver first of all navigate to
http://www.seleniumhq.org/download/
Download WebDriver by selecting appropriate version shown below.
Step 2:
A Zipped file is been installed into your computer. Unzip it and it would be displayed as show below. How to deal with this files and how to map it to make Selenium WebDriver script with, we will learn in next article.
What’s next?
We will learn how to develop Selenium WebDriver script using these configurations in next clip.
No comments:
Post a Comment