0% found this document useful (0 votes)
36 views

Selenium Supported Browsers Include:: How To Declare IE, FF and Chrome in Selenium

The document provides information about declaring browsers in Selenium and summarizes Selenium IDE and common Selenium commands. It discusses how to declare supported browsers in Selenium like Firefox, Chrome, Internet Explorer. It then summarizes what Selenium IDE is and how to get it from the Selenium website. It discusses common Selenium commands like click, type, assertTextPresent and provides examples of using them. It also summarizes how to create test suites in Selenium IDE by creating an HTML file with links to individual test cases.

Uploaded by

Pavan Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Selenium Supported Browsers Include:: How To Declare IE, FF and Chrome in Selenium

The document provides information about declaring browsers in Selenium and summarizes Selenium IDE and common Selenium commands. It discusses how to declare supported browsers in Selenium like Firefox, Chrome, Internet Explorer. It then summarizes what Selenium IDE is and how to get it from the Selenium website. It discusses common Selenium commands like click, type, assertTextPresent and provides examples of using them. It also summarizes how to create test suites in Selenium IDE by creating an HTML file with links to individual test cases.

Uploaded by

Pavan Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

How to declare IE,FF and Chrome in Selenium

Selenium supported browsers include:

*firefox
*mock
*firefoxproxy
*pifirefox
*chrome
*iexploreproxy
*iexplore
*firefox3
*safariproxy
*googlechrome
*konqueror
*firefox2
*safari
*piiexplore
*firefoxchrome
*opera
*iehta
*custom
on session null

Selenium Tutorial :
Selenium Tutorial

What is Selenium? :
What is Selenium? Javascript framework that runs in your webbrowser Works
anywhere Javascript is supported Hooks for many other languages Java,
Ruby, Python Can simulate a user navigating through pages and then assert for
specific marks on the pages All you need to really know is HTML to start using
it right away

Where to get it? :


Where to get it? You can use Selenium-Core and customize everything But it
is easier to just get a Firefox plug-in Selenium-IDE that helps you record test
cases You can record how an app is being used and then play back those
recordings followed by asserts Get everything at: www.openqa.org/selenium/

Selenium IDE :
Selenium IDE The list of actions in the actual test case to execute The root of
web application you want to test The log of the events that were executed,
including any errors or warning that may have occurred

Selenium IDE :

Selenium IDE Execution Commands Record test actions Try the test in the Web
based TestRunner Specify commands, including asserts Reference of the
currently selected command

Test Creation Demo :


Test Creation Demo Create test case to log into the gallery Create test case
to log out of the gallery

Slide 7:
Start Pixory Connect to the Server Go to the Login Screen Hit the Record Button

Slide 8:
Type in Username and Password Hit record again to stop Hit submit IDE should
update

Slide 9:
Add assertTextPresent and type the text to search for Hit play to make sure your
test is successful

Creating a Test Suite :


Creating a Test Suite A Test Suite in Selenium is just an HTML file that contains a
table of links to tests Demo Test Suite
Demo Test Suite
TestLogin
TestLogout

Executing the Test Suite :

Executing the Test Suite Selenium Core is a collection of Javascript and HTML
with iFrames Due to security concerns Core must be deployed within the same
server as the application being hosted The simplest way to run Pixory is to just
run the Java application and let it use its own server Problems using Core with
Pixory Selenium IDE is a plug-in for Firefox and thus can go around these
restrictions

Running the Test Suite :


Running the Test Suite We basically want to execute the test suite using the
Selenium IDE plug-in TestRunner.html chrome://seleniumide/content/selenium/TestRunner.html? baseURL=&test=file:///&auto=true
chrome://selenium-ide/content/selenium/TestRunner.html?
baseURL=http://localhost:8081&test=file:///Users/ms333/
projects/classes/running/v_and_v/hw3/selenium/test/ TestSuite.html&auto=true

Test Suite :
Test Suite

Test Suite :
Test Suite Execution Control Test Cases Steps of the test case Application being
tested

Test Runner Control :


Test Runner Control

Test Runner Control :


Test Runner Control Pause/Play Execution Step through Execution Control Speed
of Execution Summary of the Test View the log of the current execution View the
DOM of the current Page being tested Highlight Elements in the Execution Run All
Tests Run Selected Test

TestRunner Demo :
TestRunner Demo Execute Tests created inside the Firefox TestRunner.

Selenium Commands
Element Locator
Element Locators tell Selenium which HTML element a command refers to.
The format of a locator is: locatorType=argument
Example: - (link=click)
Selenium supports the following strategies for locating elements:
id=id
Select the element with the specified @id attribute
name=name
Select the first element with the specified @name attribute.

username

name=username

xpath=xpathExpression
Locate an element using an XPath expression.

xpath=//img[@alt='The image alt text']

xpath=//table[@id='table1']//tr[4]/td[2]

link=textPattern
Select the link (anchor) element which contains text matching the
specified pattern.

link=The link text

Important Selenium Commands

Comm
and

Usage

Descriptio
n

start()

selenium.start();

Launches
the
browser
with a new
Selenium
session

stop()

selenium.stop();

Ends the
current
Selenium
testing
session
(normally
killing the
browser)

selenium.click("link=H
ome");

Clicks on a
link,
button,
checkbox
or radio
button. If
the click
action
causes a
new page
to load
(like a link
usually
does), call
waitForPag
eToLoad.

click()

selenium.click("name=
send");

double
Click()

type()

Double
clicks on a
link,
button,
checkbox
or radio
button. If
the double
click
action
causes a
new page
to load
(like a link
usually
does), call
waitForPag
eToLoad.
Type(
string locator,
string value
);

Sets the
value of
an input
field, as

Selenium Basics Part - 3


Selenium Commands Selenese

A command is what tells Selenium what to do. Selenium commands come in


three flavors:Actions, Accessors and Assertions.
Actions are commands that generally manipulate the state of the application.
They do things like click this link and select that option. If an Action fails, or
has an error, the execution of the current test is stopped.
Many Actions can be called with the AndWait suffix, e.g. clickAndWait. This
suffix tells Selenium that the action will cause the browser to make a call to the
server, and that Selenium should wait for a new page to load.
Accessors examine the state of the application and store the results in variables,
e.g. storeTitle. They are also used to automatically generate Assertions.
Assertions are like Accessors, but they verify that the state of the application
conforms to what is expected. Examples include make sure the page title is X
and verify that this checkbox is checked.
Script Syntax
Selenium commands are simple, they consist of the command and two
parameters. For example:
verifyText

//div//a[2]

Login

The parameters are not always required; it depends on the command. In some
cases both are required, in others one parameter is required, and in still others
the command may take no parameters at all. Here are a couple more examples:
goBackAndWait
verifyTextPresent

Welcome to My Home Page

type

id=phone

(555) 666-7066

type

id=address1

${myVariableAddress}

The command reference describes the parameter requirements for each


command.
Parameters vary, however they are typically:
a locator for identifying a UI element within a page.
a text pattern for verifying or asserting expected page content

a text pattern or a selenium variable for entering text in an input field or for
selecting an option from an option list.

Test Suites
A test suite is a collection of tests. Often one will run all the tests in a test suite
as one continuous batch-job.
When using Selenium-IDE, test suites also can be defined using a simple HTML
file. The syntax again is simple. An HTML table defines a list of tests where each
row defines the filesystem path to each test. An example tells it all.
Test Suite Function Tests - Priority 1

A file similar to this would allow running the tests all at once, one after another,
from the Selenium-IDE.
Test suites can also be maintained when using Selenium-RC. This is done via
programming and can be done a number of ways. Commonly Junit is used to
maintain a test suite if one is using Selenium-RC with Java. Additionally, if C# is
the chosen language, Nunit could be employed. If using an interpreted language
like Python with Selenium-RC than some simple programming would be involved
in setting up a test suite. Since the whole reason for using Sel-RC is to make use
of programming logic for your testing this usually isnt a problem.

Commonly Used Selenium Commands


To conclude our introduction of Selenium, well show you a few typical Selenium
commands. These are probably the most commonly used commands for building
tests.
open
opens a page using a URL.
click/clickAndWait
performs a click operation, and optionally waits for a new page to load.
verifyTitle/assertTitle

verifies an expected page title.


verifyTextPresent
verifies expected text is somewhere on the page.
verifyElementPresent
verifies an expected UI element, as defined by its HTML tag, is present on the
page.
verifyText
verifies expected text and its corresponding HTML tag are present on the page.
verifyTable
verifies a tables expected contents.
waitForPageToLoad
pauses execution until an expected new page loads. Called automatically when
clickAndWait is used.
waitForElementPresent
pauses execution until an expected UI element, as defined by its HTML tag, is
present on the page.
Summary
Now that youve seen an introduction to Selenium, youre ready to start writing
your first scripts. We recommend beginning with the Selenium IDE and its
context-sensitive, right-click, menu. This will allow you to get familiar with the
most common Selenium commands quickly, and you can have a simple script
done in just a minute or two.

Locating Elements
For many Selenium commands, a target is required. This target identifies an
element in the content of the web application, and consists of the location
strategy followed by the location in the format locatorType=location. The locator
type can be omitted in many cases. The various locator types are explained
below with examples for each
Locating by Id
Locating by Name
Locating by XPath
Locating Hyperlinks by Link Text

Locating by DOM
Locating by CSS

Store commands
storeElementPresent
This corresponds to verifyElementPresent. It simply stores a boolean valuetrue
or falsedepending on whether the UI element is found.
storeText
StoreText corresponds to verifyText. It uses a locater to identify specific page
text. The text, if found, is stored in the variable. StoreText can be used to extract
text from the page being tested.
storeEval
This command takes a script as its first parameter. Embedding JavaScript within
Selenese is covered in the next section. StoreEval allows the test to store the
result of running the script in a variable.

Selenium Basics Part - 2


Get started with Selenium!

1.

Watch: see the magic.

This video will tell you how to record tests using Selenium IDE.
http://seleniumhq.org/movies/intro.mov
2.

Begin: write and run tests in Firefox

Selenium IDE is a Firefox add-on that records clicks, typing, and other actions to
make a test, which you can play back in the browser.
3.

Customize: your language, your browser.

Selenium Remote Control (RC) runs your tests in multiple browsersand platforms.
Tweak your tests in your preferred language.

4.

Deploy: scale out, speed up.

Selenium Grid extends Selenium RC to distribute your tests across multiple


servers, saving you time by running tests in parallel.

Who should use it?


Developers can use it - for browser regression testing ( and replace
htmlunit/httpunit in some cases) .
Per the one of the forces behind selenium(Neal ford) - it should really be used by
Business Analyst first .
QA should enhance/use it do regression test/cross browsers testing on all
platforms .

Platforms Supported by Selenium

Browsers
Browser Selenium IDE

Selenium Remote Control

Selenium Core

Firefox 3 Record and playback tests Start browser, run tests

Run tests

Firefox 2 Record and playback tests Start browser, run tests

Run tests

IE 8

not supported

Start browser, run tests

Run tests

IE 7

not supported

Start browser, run tests

Run tests

Safari 3

not supported

Start browser, run tests

Run tests

Safari 2

not supported

Start browser, run tests

Run tests

Opera 9 not supported

Start browser, run tests

Run tests

Opera 8 not supported

Start browser, run tests

Run tests

Others

Partial support possible*

Run tests**

Selenium Remote Control

Selenium Core

Windows Works in Firefox 2+

Start browser, run tests

Run tests

OS X

Works in Firefox 2+

Start browser, run tests

Run tests

Linux

Works in Firefox 2+

Start browser, run tests

Run tests

Solaris

Works in Firefox 2+

Start browser, run tests

Run tests

Others

Should work in Firefox 2+ Start browser, run tests*

not supported

Operating Systems
OS

Selenium IDE

Run tests**

Programming Languages
Programming languages are supported through Selenium Remote Control
"drivers." These are libraries made for each language that expose commands
from the Selenium API natively in the form of methods/functions.
Language Selenium IDE

Selenium Remote Control

Selenium Core

C#

Generate code

Library ("driver") support

n/a

Java

Generate code

Library ("driver") support

n/a

Perl

Generate code

Library ("driver") support

n/a

PHP

Generate code

Library ("driver") support

n/a

Python

Generate code

Library ("driver") support

n/a

Ruby

Generate code

Library ("driver") support

n/a

Others

Generate custom code* Commands via HTTP requests** n/a

Testing Frameworks
Testing frameworks aren't required, but they can be helpful if you want to
automate your tests.
Selenium Remote Control

Selenium
Core

Framework

Selenium IDE

Bromine

Comes with
Manipulate browser, check Special
template to add to
assertions via custom driver support**
IDE

JUnit

Out-of-the-box
code generation

Manipulate browser, check


assertions via Java driver

n/a

NUnit

Out-of-the-box
code generation

Manipulate browser, check


assertions via .NET driver

n/a

RSpec (Ruby)

Custom code
generation
template*

Manipulate browser, check


assertions via Ruby driver

n/a

Test::Unit (Ruby)

Out-of-the-box
code generation

Manipulate browser, check


assertions via Ruby driver

n/a

TestNG (Java)

Custom code
generation
template*

Manipulate browser, check


assertions via Java driver

n/a

unittest (Python)

Out-of-the-box
code generation

Manipulate browser, check


n/a
assertions via Python driver

Others

Custom code
generation
template*

Manipulate browser, check


assertions via HTTP
requests***

n/a

Robot Framework
SeleniumLibrary

n/a

Utilizes the Python driver

n/a

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy