Friday 23 September 2011

Information commands

we can take the information from the appln by using the below commands.

getValue(): gets the value from input field.
str=selenium.getValue("id=ist-lib");
getHtmlSource():
we can take the source code of the current page to a string.
String str=selenium.getHtmlSource();
getBodyText():
to take text of the current page
getLocation():
gets the absolute url of the appln
getAllButtons:
  String  str[]=selenium.getAllButtons();
getAllLinks():
gets list of links which are in current page.
getTitle():
getAllFields():
gets the list of fields(type or textboxs) id's
getAllWindowNames():
take list of window names currently opened by selenium
getAllWindowIds()
getAllWindowTitles():
String str[]=selenium.getAllWindowTitles()
sysout(str[0])
sysout(str[1])

Friday 2 September 2011

Selenium Rc


Selenium is a suite of tools to automate web app testing across many platforms. It is a GUI based automation tool. Initially it is built by Thought Works. It supports various browsers on various platforms
Selenium Components:
1) Selenium IDE
Selenium IDE can be used only in FireFox. It is an add-on for FireFox. User can record the actions and can edit and debug the tests. It can be used to identify IDs, name and XPath of objects. Only one test at a time.
2) Selenium RC (Remote Control)

Selenium Remote Control is a test tool that allows user to write automated web application UI tests in few programming languages against any HTTP website using any mainstream JavaScript-enabled browser. User can write the tests (More expressive programming language than the Selenese HTML table format) in Java, DotNet, Perl, Ruby and PHP. Also it supports few testing frameworks.
3) Selenium Grid:

   
   
   
   
   
   
   
  
Selenium Grid allows easily to run multiple tests in parallel, on multiple machines, in an

heterogeneous environment by cutting down the time required for test execution. Using this, user can run multiple instances of Selenium Remote Control in parallel. 
 Selenium Supported Browsers:

Selenium tools can run in following browsers.
* Internet Explorer
* FireFox
* Opera
*Chrome
* Safari
* Seamonkey

supported Operating system:

Users can execute the selenium tests in following OS.
* Windows
* Linux
* Solaris
* OS X
Supported Programming langages:

Below languages are supported by Selenium RC.
* C# (DotNet)
* Java
* Perl
* Ruby
* Python
* PHP
Required Software:

  • Jdk 1.5.0_11 or above

  • Eclipse (Version 3.5.2) –

  • 4 Jar files (junit-4.5, jxl, selenium-java-client-driver, selenium-server)







 

Selenese

the selenium often callled as selenese
Browser Commands:
start(): to lunch the browser.
open(): to open the url of the application
windowMaximize() to maximize the current window.
stop(): to stop the execution of the script
close(): to kill the browser
Interaction Commands:
type(): to enter some value into the textbox
selenium.type("property name","value");
click(): by using this command we can click on a button,radio button, check box,image and link.
selenium.click("property name")  //button, radio button and check box,image
selenium.click("link=display name") //link
select(): to select some value from combo box,drop down or list box
selenium.select("property name","male");
check(): to click ona check box
selenium.check("property name");
selectWindow(): to identify the popups
selenium.selectWindow("window name or id or title");
getAlert(): to click on "Ok" button on the alet box
selenium.getAlert();
getConfirmation: to click "Ok" on the confirmation message
selenium.getConfirmation();
selenium.chooseCancelonNextConfirmation();

writting methods in selenium

block of statements which are accountable for a specific task.methods are reusable and can call from main() and with in the function.
Syntax: public static String funcName()
{
return "pass";
}
WAP to login into In.com
Note: whenever you are using methods in the program then we have declare the selenium object globally either public or private.
public : we can use the object with in the class as well as outside of the class.
private: we use the object with in a class only.
public static DefaultSelenium selenium=new defaultSelenium("localhost",4444,"*firefox","http://");
public static String openUrl()
{
selenium.start();
selenium.open("http://mail.in.com");
selenium.windowMaximize();
return "pass";
}
public static String login()

{
selenium.type("f_id","selenium_froum");// give username for mail.in
selenium.type("f_pwd","test12234");
selenium.click("css=input.signin");
return "pass";
}
public static void main(String args[])
{
openUrl();
login();
}
}

Thursday 1 September 2011

Selenium Vs QTP

Selenium: 1) Open Source 2) it supports languages like Html, Java, Perl, Phython, php.3) supported browsers Firefox,IE, Chrome, Safari, Opera 4) supported Operating systems: windows, linux, mac 5) web applications 6) fliexble and extendable


QTP: 1) Commercial tool 2) Vb script 3) IE and Firefox 4) windows only 5) desktop and web applications 6) flexible

Selenium Automation Testing

Selenium is Open source and regression automation testing tool. Selenium having 3 components.


1) Selenium IDE : its a Firefox Add-on. IDE standards for Integrated Development Environment. Selenium IDE used for only record and replay and only for Firefox.
download Selenium IDE from this site http://seleniumhq.org/download/