Seleniumtest.files.wordpress.com



Guideline for

Selenium-open source Automation Tool

Prepared By:

InfoStretch Corporation

[pic]

HISTORY OF REVISIONS

|Revision |Date |By |Description |

|1.0 |11/04/08 |Niranjan Limbachiya |Created |

| | | | |

| | | | |

| | | | |

TABLE OF CONTENTS

1. Introduction 3

1.1 Selenium Origin 3

1.2 What is Selenium 3

1.3 What is selenium for? 4

1.4 Platform and Browser’s compatibility 4

2. Selenium IDE 5

2.1 Features: 5

3. Selenium Core 5

3.1 HTA Mode 6

3.2 . HTA file 6

3.3 Cross-site scripting 6

4. Selenium RC 6

4.1 How to Start Selenium Server 7

5. Install PHPUnit 8

6. Proxy Injection Mode 8

7. Steps to Run Webased application in IE 9

Introduction

Selenium tests run directly in a browser, just as real users do. And they run in Internet Explorer, Mozilla and Firefox on Windows, Linux, and Macintosh.

If you are first time Using Selenium then, don’t use directly Selenium Core, work with IDE first then move to core

Download from

Note: Download for this link is not working in Firefox browser. So please use IE and download .xpi file

Note: No other test tool covers such a wide array of platforms

When you want to download the xpi file with firefox, it should automatically ask you to install the plugin.

In case if we downloaded the file with Opera or IE. No problem:

• Open firefox

• from the menu: Tools ->Add-ons--> Extensions

• now drag-n-drop the xpi file to the extensions window

• restart firefox

• You can see a 'Selenium IDE' entry from your tools menu

1 Selenium Origin

• Selenium is a chemical element in the periodic table that has the symbol Se and atomic number 34

• Selenium was developed by team of programmers and testers at ThoughtWorks

• Javascript Functional Test Runner was written by Jason Huggins, Paul Gross and Jie Tina Wang, in 2004.

• Jason started demoing the test tool to various colleagues. Many were excited about its immediate and intuitive visual feedback, as well as its potential to grow as a reusable testing framework for other web applications.

2 What is Selenium

• A java Script Based

• Open Source

• Web Testing Tool

• That Support web 2.0 Application

• On Multiple Browser

• And multiple OS

3 What is selenium for?

• It is used for functional or system testing web applications.

• These tests are also sometimes called

o Acceptance, customer,

o Integration tests.

Selenium is not meant for unit testing

4 Platform and Browser’s compatibility

Supported Platforms:

• Windows:

o Internet Explorer 6.0

o Firefox 0.8 to 1.5

o Mozilla Suite 1.6+, 1.7+

o Seamonkey 1.0

o Opera 8

• Mac OS X:

o Safari 1.3+

o Firefox 0.8 to 1.5

o Camino 1.0a1

o Mozilla Suite 1.6+, 1.7+

o Seamonkey 1.0

• Linux:

o Firefox 0.8 to 1.5

o Mozilla Suite 1.6+, 1.7+

o Konqueror

Selenium IDE

❑ Selenium IDE is an integrated development environment for Selenium tests

❑ It is implemented as a Firefox extension. (Note no IE Extension Available)

❑ It allows us to record, edit, and debug tests

❑ Selenium IDE includes the entire Selenium Core, allowing you to easily and quickly record and play back tests in the actual environment that they will run.

❑ Selenium IDE is not only recording tool: it is a complete IDE

❑ You can choose to use its recording capability, or you may edit your scripts by hand

1 Features:

• Easy record and playback

• Intelligent field selection will use IDs, names, or XPath as needed

• Auto complete for all common Selenium commands

• Walk through tests

• Debug and set breakpoints

• Save tests as HTML, Ruby scripts, or any other format

• Support for Selenium user-extensions.js file

Option to automatically assert the title of every page

Selenium Core

• Selenium Core is a test tool for web applications

• Selenium Core tests run directly in a browser, just as real users do

• And they run in

o Internet Explorer,

o Mozilla

o Firefox

▪ Windows,

▪ Linux,

▪ Macintosh

• Written in pure JavaScript/DHTML

• You copy Selenium Core tests directly into your application web server, allowing the tests to run in any supported browser on the client-side

• Selenium Core was developed by team of programmers and testers at ThoughtWorks

1 HTA Mode

• Selenium Core provides an additional mechanism for running automated tests called "HTA mode."

• If you're on Windows and you only want to use Selenium Core with Internet Explorer, you may also use HTA mode to run your tests against a remote web site.)

• To run Selenium Core in HTA mode, just double-click on TestRunner.hta, in the /core directory of your Selenium installation.

2 . HTA file

• An hta file is simply an html file but the extension “. hta” means that when we navigated to IE, it will apply same strict security measure.

This file define layout of your testing GUI.

3 Cross-site scripting

• Cross-site scripting security built into JavaScript engines in all browsers, you can't edit the content of a web page from another domain.

• Mostly People are used this scripting for Hacking

Selenium RC

• Selenium Remote Control is a test tool that allows you to write automated web application in any programming language (Java, .NET, Perl, Python, and Ruby, PHP)

• Selenium Remote Control provides a Selenium Server, which cans automatically start/stop/control, any supported browser.

• The Selenium Server communicates directly with the browser using AJAX

• You can send commands directly to the Server using simple HTTP GET/POST requests;

• Finally, the Selenium Server acts as a client-configured HTTP proxy, to stand in between the browser and your website.

1 How to Start Selenium Server

• The Selenium Server is written in Java, and requires the Java Runtime Environment (JRE) version 1.5.0 or higher in order to start. You may already have it installed. Try running this from the command line:

java -version

• Once you've got Java installed and ready to go, you can start the Selenium Server from the command line like this:

Go to /selenium directory/server/

java -jar selenium-server.jar -interactive

• That will start the Selenium Server and allow you to type commands in the command window. After a number of log messages, you should see the following message:

Entering interactive mode... type Selenium commands here (e.g: cmd=open&1=) 

• Let's begin by using Selenium Server to open up a browser. If you're on Windows and want to run your Selenium commands using Internet Explorer, try typing this:

cmd=getNewBrowserSession&1=*iexplore&2=

If you want to use Firefox, try this:

cmd=getNewBrowserSession&1=*firefox&2=

• Typing commands in this window automatically fires off HTTP web requests to the Selenium Server, requesting work to be done. (In non-interactive mode, you can use any automated tool you like to send these HTTP requests to the server, instead of typing them by hand.) When you press Enter, you'll see a message describing the request you just made:

---> Requesting *firefox&2=

• If all goes well, you should see a new browser window starting with the browser of your choice. Back in the Selenium Server command window, you should see the following message:

Got result: OK, 260113 on session 260113

Install PHPUnit

• To Use pear command go to C:/ Programme Files/Xampp/php/pear and type pear in command prompt

• Type following command

o Pear channel-discover pear.phpunit.de

o Pear install phpunit/phpunit

Note: You need atleast PHP version 5.2.4 to install PHPUnit

• Use Following command to install Image_Graphviz

o Pear install or Upgrade Image_Graphviz

• Batch file for phpunit will be install in /xampp/php folder. Move from this folder to /xampp/php/pear/PHPunit folder

• Go that folder and type phpunit command

Proxy Injection Mode

The two experimental "proxy injection mode" browser launchers are:

• *piiexplore

• *pifirefox

"Proxy injection" mode is a new highly experimental feature for 0.9.0

• Normal Mode

▪ They Keep two automated test windows—

▪ One for Selenium, and

▪ One for your application under test (AUT)

• Proxy injection mode

▪ They eliminate the separate Selenium window, in favor of "injecting" Selenium into every HTML page.

▪ By injecting ourselves into the HTML, They have increased control over the AUT

▪ To use PI mode, you need to start the Selenium Server with a special command line argument, like this:

java -jar selenium-server.jar -proxyInjectionMode

cmd=getNewBrowserSession&1=*pifirefox&2=

If Firefox is installed in a non-standard location, you can launch *pifirefox mode like this:

cmd=getNewBrowserSession&1=*pifirefox c:\firefox\firefox.exe&2=

Steps to Run Webased application in IE

CASE I: If Selenium Server is in Proxy InjectionMode

• Start server in Proxy Injection Mode

• Run Selenium IDE and record step

o Go to Options(Format(PHP-selenium RC

o Copy that PHP code and paste in PHPUnit Folder

▪ PHPUnit will be in C:\Program Files\xampp\php\pear\PHPUnit

▪ Make xyz.php file (you could give different Name)

• Open that PHP file and change following line from

$this-(Selenium= new Testing_Selenium (“*firefox”,);

to

$this-(Selenium= new Testing_Selenium(“*iexplore”,);

• Now type command phpunit xyz.php

• It will open IE browser for you and Test the application

CASE II: If Selenium Server isn’t in Proxy InjectionMode

• Run Selenium IDE and record step

o Go to Options(Format(PHP-selenium RC

o Copy that PHP code and paste in PHPUnit Folder

▪ PHPUnit will be in C:\Program Files\xampp\php\pear\PHPUnit

▪ Make xyz.php file (you could give different Name)

• Open that PHP file and change following line from

$this-(Selenium= new Testing_Selenium (“*firefox”,);

to

$this-(Selenium= new Testing_Selenium (“*iehta”,);

-----------------------

Your Website

Browser

Selenium Server

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download