Sunday, 6 May 2012

How to install Java?

How to install Java?

Click on the 'Free Java Download' button and proceed to download further and install Java on your system.

Java is an open source programming language.
After Java is installed successfully in your system you can see the Java folder is created inside the hard drive you have chosen while installing.

To write code and manage code in Java programming language one can use any editor or one can use IDE as well.

One can use notepad, notepad++ and many editors like that.
Or else one can use Eclipse, Netbeans and many IDE also.

For bigger projects we are supposed to use the IDE or else when the project complexity increases the number of java files also increases then it is not really possible to manage these files without using any IDE.

Saturday, 5 May 2012

How to install firebug, & firepath?

How to install Firebug?

Navigate to the link: http://getfirebug.com/  and click on the 'Install Firefox' button.

Now follow the steps and install firebug as an add-on in the Mozilla Firefox browser.

How to install Firepath?

After you have installed firebug you can be able to install firepath.
Navigate to the url: https://addons.mozilla.org/en-US/firefox/addon/firepath/



Click on the button 'Add to Firefox' and follow the steps to install firepath on firebug.

After you have installed firepath successfully you can see as given below:


What is XPath?

XPath is normally called as XML Path.

We use XPath to navigate through elements, and attributes in the XML document.
As per W3C's, the XPath is a major element in XSLT standard - and XQuery and XPointer are both built on XPath expressions.

XPath is the language for finding information in an XML document.

What XPath is?
  • It is a syntax for defining parts of an XML document
  • It uses path expressions to navigate in XML documents
  • It contains the library of standard functions
  • It is vital element in XSLT
  • It is W3C recommendation



Normally in every web-based applications the XPaths or locators are unique addresses for each and every web object. It can be used with selenium to
perform operations on each object present in the webpage. In the web page each web-object has a primary unique XPath.

XPaths are derived from the html paths of the objects. One can install firebug, and on the top of firebug, one can install firpath. Both are installed as addons on Firefox.
 
When one extracts the xpath of the object, one can use that object using Selenium IDE, Selenium RC, or Selenium Web-driver. Xpaths are constants. They do rarely change. If there is a text-box, and the label of the text-box changes but the position does not change then xpath remains the same. Sometimes xpaths alo vary everytime you refresh the page. To handle variable XPath you need to use java-script functions. Varying xpaths always have a pattern.

Difference between Selenium IDE, Selenium RC, Selenium Webdriver

Selenium IDE Selenium RC Selenium Web-driver
Only works on Mozilla Firefox Works on almost all browsers.Does not work on latest version of Firefox/IE Works on latest versions of almost all browsers - Firefox, IE(6,7,8), Opera, Chrome
Record and play/run tool No Record and run No Record and run
No server required to start Server is required to start No server required to start
Core engine is JavaScript based Core engine is JavaScript based Interacts natively with browser application
Very simple to use. If using User extensions, you require knowledge on java script which makes the work a little bit tough. Its a simple and small API Complex and a bit large API as compared to RC
Not at all object oriented Less Object oriented API Purely Object oriented API
Cannot move mouse with it Cannot move mouse with it Can move mouse cursor
Full xpaths have to be appended with 'xapth=\\' syntax Full xpaths have to be appended with 'xapth=\\' syntax No need to append 'xpath=\\'
No Listeners No Listeners Implementation of Listeners is provided
Cannot test iPhone/Android applications Cannot test iPhone/Android applications Can test iPhone/Android applications
Cannot test iPhone/Android applications Cannot test iPhone/Android applications Can test iPhone/Android applications

Wednesday, 25 April 2012

Configure Selenium RC server

How to configure 'Selenium RC' server?

To configure 'Selenium RC' server one has to download the latest jar file from the link given below: http://seleniumhq.org/download/


Click on the download link 'Download version 2.21.0' and download the jar file to the local hard drive of your system. 



After the download is complete, place the jar file in any place  in your hard driver. For instance I have place the jar file inside the 'C:' drive in my system.

->Just open the command prompt that is cmd prompt by: 
   Start-->Run-->type 'cmd' and click 'Ok'.
->Browse to the directory where 'Selenium RC' server jar file is located.
   In my case it is in the 'C:' drive.
->Now after going to that location in the command prompt simply type the following
   command as given in the screenshot below: 
    java -jar selenium-server-standalone-2.5.0.jar




If everything is fine, then one will be able to see the output like below given:
 Apr 25, 2012 10:36:56 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
22:37:01.226 INFO - Java: Oracle Corporation 22.1-b02
22:37:01.248 INFO - OS: Windows 7 6.1 amd64
22:37:01.342 INFO - v2.5.0, with Core v2.5.0. Built from revision 13516
22:37:01.787 INFO - RemoteWebDriver instances should connect to: http://127.0.0.
1:4444/wd/hub
22:37:01.790 INFO - Version Jetty/5.1.x
22:37:01.813 INFO - Started HttpContext[/selenium-server/driver,/selenium-server
/driver]
22:37:01.815 INFO - Started HttpContext[/selenium-server,/selenium-server]
22:37:01.816 INFO - Started HttpContext[/,/]
22:37:02.006 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@36d650
da
22:37:02.007 INFO - Started HttpContext[/wd,/wd]
22:37:03.125 INFO - Started SocketListener on 0.0.0.0:4444
22:37:03.126 INFO - Started org.openqa.jetty.jetty.Server@4115fa10

Now the 'Selenium RC' server is started so when the testcases created  for the 'Selenium RC' server one has to first start the 'Selenium RC' server and then run the testcases for the 'Selenium RC'.

Configure Selenium RC

How to download and configure/install Selenium RC?

Selenium RC stands for 'Selenium Remote Control'. 
Selenium RC can be configured in the following way:

First one needs to download the latest jar file from the selenium official website.

Second unzip the downloaded jar files and include them in the Selenium RC project.

Here are the steps given below:

One can download the Selenium RC from the given link below:


Click on the link in the screenshot given above, and download the zip file to the local system and unzip the downloaded zip file.

We will configure 'Selenium RC' using the 'Eclipse IDE'.

Now in the 'Project Explorer' right click inside it and click on the 'New -> Project' as given in the screenshot below:


Now in the 'New Project' dialog box click on the 'Java Project' and click n the 'Next' button.


In the next window give the project name and click on the 'Finish' button.


Now the user is displayed a screen like this given below:


In the left hand side right click on the project name and click on the 'Properties' option as given in the screenshot below:



Now in the properties dialog box click on the 'Java Build Path' and click no the 'Libraries' tab as given in the screenshot below:





In the above dialog box click on the 'Add External JARs...' button and browse for the jar files which is downloaded for the 'Selenium RC' as given in the screenshot below:



choose the jar files under the 'E:\workspace\selenium-remote-control-1.0.3\selenium-java-client-driver-1.0.1' folder and include all the jars and click on the open button the user is displayed the screenshot like this given below:


In the above click on the 'Ok' button and now one can see all the jars included in it. Now 'Selenium RC' is configured in your system with 'Eclipse IDE'. One can write the code in java and execute in the 'Selenium RC', and it will automate the browser actions as per the java code.

In 'Selenium RC' if you have to run test cases then you have to start selenium-server.jar which is needed to start 'Selenium RC' server. In 'Selenium Webdriver', there is no server which you need to start to run the 'Selenium Webdriver' based testcases.

Tuesday, 24 April 2012

Configure Selenium Webdriver

How to download and configure/install Selenium Webdriver?

Selenium can be configured in the following ways:

First one needs to download the latest jar files from the selenium official website.

Second unzip the downloaded jar files and include them in the Selenium project.

Here are the steps given below:

One can download the selenium webdriver from the given link below:
http://seleniumhq.org/download/


Click on the download link as per the desired language you want to configure Selenium Webdriver. The example is shown for the Selenium Webdriver configured with Java language.

Once the download link is clicked the user is asked to save the zip files. Then save the zip files into the hard drive of your local system. When the zip files are downloaded properly just unzip the files to get files inside a folder.

We will configure using 'Eclipse IDE'. First we need to download the Eclipse from the 'Eclipse' website.

Go to the website: http://www.eclipse.org/downloads/ and download the following as given in the screenshot:




Please download the version "Eclipse IDE for Java EE Developers, 212 MB", and choose the 32 bit or 64 bit as per your system.

After the download is successful unzip the zip folder for 'Eclipse' and place the folder anywhere in your hard disk drive. In this example I have place it in 'E' drive. Now go to the 'Eclipse' folder as per the given the screenshot below:


Click on the 'eclipse.exe' and there will be a security dialog box. Just click on the 'Run' button and one can see the 'Eclipse' will launch with the following window:


Give the workspace name as per your desired requirement or else you can choose for different workspace location by clicking on the 'Browse' button. After you are done with setting your workspace path click on the 'Ok' button and it displays a window like this given below:


If you want to read about 'Eclipse' then click on the relevant links or else simply just click on the cross button of the 'Welcome' tab. Then the user is displayed with this window:

Now in the 'Project Explorer' right click inside it and click on the 'New -> Project' as given in the screenshot below:

Now in the 'New Project' dialog box click on the 'Java Project' and click n the 'Next' button.


In the next window give the project name and click on the 'Finish' button.



Now the user is displayed a screen like this given below:



Now 'Eclipse' has been configured in the system.
Now we will configure Webdriver into it using the 'Eclipse IDE'.

In the left hand side right click on the project name and click on the 'Properties' option as given in the screenshot below:


Now in the properties dialog box click on the 'Java Build Path' and click no the 'Libraries' tab as given in the screenshot below:


In the above dialog box click on the 'Add External JARs...' button and browse for the jar files which is downloaded for the Selenium Webdriver as given in the screenshot below:

choose the jar files under the 'selenium-2.21.0' folder and 'lib' folder and include all the jars and click on the open button the user is displayed the screenshot like this given below:

In the above click on the 'Ok' button and now one can see all the jars included in it. Now 'Selenium Webdriver' is configured in your system with 'Eclipse IDE'. One can write the code in java and execute in the Selenium Webdriver and it will automate the browser actions as per the java code.