Simple Startup in Web Driver

Web driver is a java interface which is having lot of implementing classes and functions which we can refer from javadocs in selenium official site.

Download latest java client version from  http://seleniumhq.org/download/. Its a zip pack, Unzip and go to eclipse Create new java project and right click on java project and select Build Path ---> Configure build path Click "Add External Jars" and select all the jar under the unzipped folder. Then click OK.

Selenium IDE - parametrization

Parametrization is one of the key area in Test automation. We have to design and develop the maximum combination of test data to give as input. This is one of the main reason we are moving to RC. But it can be possible in Selenium IDE too.

Steps to invoke the data file in to Selenium IDE

Shutdown Selenium Server from browser URL

Selenium server operates a web server under Jetty it can receive commands via http through browsers.
The following URL will be used to shut down the server.
If we want to leave the server running and just close down the current session we could issue the following URL in a browser.

Java Script Tweaks

Java Script get Current Date:
Some of the Calender Controls couldn't be handled by Selenium.

This will return the Current Date as ""MM/DD/YYYY"
javascript{var currentDate = new Date(); var month = currentDate.getMonth() + 1; if (month < 10) { month = "0" + month }; var day = currentDate.getDate(); if (day < 10) { day = "0" + day }; var year = currentDate.getFullYear(); curentDate=(month + "/" + day + "/" + year);}

JUnit Syntax:
String t1 = selenium.getExpression(selenium.getEval("var currentDate = new Date(); var month = currentDate.getMonth() + 1; if (month < 10) { month = \"0\" + month }; var day = currentDate.getDate(); if (day < 10) { day = \"0\" + day }; var year = currentDate.getFullYear(); curentDate=(month + \"/\" + day + \"/\" + year);"));
selenium.type("StartDate", t1);

Selenium Data Driven using Properties files

We need to get value from a data source for different purpose here listed some of the basics.
  • GUI Components
  • Test Data
  • URLs
GUI Components:
If we have mapped the GUI components with a value we can change the value in a single place rather changing in whole script where ever we used.
Test Data:
We can pre designed test data with all available or maximum possible combination of  user input.
URLs:

Sample Template - Test Scenario


How to Handle HTTPS and Security Popups in Selenium RC

Now a days many web applications switching from HTTP to HTTPS for giving the security assurance to the users to share their password and Credit card information safely with the site.

To ensure HTTPS site is genuine the browser should have a security certificate. Otherwise, when the browser access the Application Under Test using HTTPS. It will assume that application is not trusted. When this occurs the browser will display security popups and these popups can not be closed by selenium RC.