Selenium Supported Browsers Include:: How To Declare IE, FF and Chrome in Selenium
Selenium Supported Browsers Include:: How To Declare IE, FF and Chrome in Selenium
*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
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
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
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
Test Suite :
Test Suite
Test Suite :
Test Suite Execution Control Test Cases Steps of the test case Application being
tested
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=//table[@id='table1']//tr[4]/td[2]
link=textPattern
Select the link (anchor) element which contains text matching the
specified pattern.
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
//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
type
id=phone
(555) 666-7066
type
id=address1
${myVariableAddress}
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.
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.
1.
This video will tell you how to record tests using Selenium IDE.
http://seleniumhq.org/movies/intro.mov
2.
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.
Selenium Remote Control (RC) runs your tests in multiple browsersand platforms.
Tweak your tests in your preferred language.
4.
Browsers
Browser Selenium IDE
Selenium Core
Run tests
Run tests
IE 8
not supported
Run tests
IE 7
not supported
Run tests
Safari 3
not supported
Run tests
Safari 2
not supported
Run tests
Run tests
Run tests
Others
Run tests**
Selenium Core
Run tests
OS X
Works in Firefox 2+
Run tests
Linux
Works in Firefox 2+
Run tests
Solaris
Works in Firefox 2+
Run tests
Others
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 Core
C#
Generate code
n/a
Java
Generate code
n/a
Perl
Generate code
n/a
PHP
Generate code
n/a
Python
Generate code
n/a
Ruby
Generate code
n/a
Others
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
n/a
NUnit
Out-of-the-box
code generation
n/a
RSpec (Ruby)
Custom code
generation
template*
n/a
Test::Unit (Ruby)
Out-of-the-box
code generation
n/a
TestNG (Java)
Custom code
generation
template*
n/a
unittest (Python)
Out-of-the-box
code generation
Others
Custom code
generation
template*
n/a
Robot Framework
SeleniumLibrary
n/a
n/a