Showing posts with label Selenium IDE. Show all posts
Showing posts with label Selenium IDE. Show all posts

Wednesday, November 5, 2014

Sample Selenium IDE Test Script by Recording:


We will use the Mercury Tours website as our web application under test. It is an online flight reservation system that contains all the elements we need for this tutorial. Its URL is http://newtours.demoaut.com/ and this will be our Base URL.

NOTE: The site http://newtours.demoaut.com/ at time is down and not available to work on. We have raised this issue with HP

  1. Create a Script by Recording


Let us now create our first test script in Selenium IDE using the most common method – by recording. Afterwards, we shall execute our script using the playback feature.

Step 1:

  • Launch Firefox and Selenium IDE.

  • Type the value for our Base URL: http://newtours.demoaut.com/.

  • Toggle the Record button on (if it is not yet toggled on by default).


1

 

Step 2:

2

 

Step 3:

  • Right-click on any blank space within the page, like on the Mercury Tours logo on the upper left corner. This will bring up the Selenium IDE context menu. Note: Do not click on any hyperlinked objects or images

  • Select the “Show Available Commands” option.

  • Then, select “assertTitle exact:Welcome: Mercury Tours”. This is a command that makes sure that the page title is correct.


3

Step 4:

  • In the “User Name” text box of Mercury Tours, type an invalid username, “invalidUN”.

  • In the “Password” text box, type an invalid password, “invalidPW”.


4 5

Step 5:

  • Click on the “Sign-In” button. Firefox should take you to this page.


6

Step 6:

  • Toggle the record button off to stop recording. Your script should now look like the one shown below.


7

Step 7:

  • Now that we are done with our test script, we shall save it in a test case. In the File menu, select “Save Test Case”. Alternatively, you can simply press Ctrl+S.


8

Step 8:

  • Choose your desired location, and then name the test case as “Invalid_login”.

  • Click the “Save” button.


9

Step 9:

  • Notice that the file was saved as HTML.


10

Step 10:

  • Go back to Selenium IDE and click the Playback button to execute the whole script. Selenium IDE should be able to replicate everything flawlessly


11

 
On 6:52 AM by Unknown in , ,    No comments

Selenium Commands – Selenese


Selenese commands can have up to a maximum of two parameters: target and value.

Parameters are not required all the time. It depends on how many the command will need.

3 Types of Commands















ActionsThese are commands that directly interact with page elements.Example: the “click” command is an action because you directly interact with the element you are clicking at.The “type” command is also an action because you are putting values into a text box, and the text box shows them to you in return. There is a two-way interaction between you and the text box.
AccessorsThey are commands that allow you to store values to a variable.Example: the “storeTitle” command is an accessor because it only “reads” the page title and saves it in a variable. It does not interact with any element on the page.
AssertionsThey are commands that verify if a certain condition is met. 3 Types of AssertionsAssert. When an “assert” command fails, the test is stopped immediately.Verify. When a “verify” command fails, Selenium IDE logs this failure and continues with the test execution.WaitFor. Before proceeding to the next command, “waitFor” commands will first wait for a certain condition to become true.If the condition becomes true within the waiting period, the step passes.If the condition does not become true, the step fails. Failure is logged, and test execution proceeds to the next command.

By default, timeout value is set to 30 seconds. You can change this in the Selenium IDE Options dialog under the General tab.

assert verify
Commonly Used Selenium Commands

To conclude our introduction of Selenium, we’ll 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 table’s 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.


List of Selenium IDE Commands:










































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































addLocationStrategy
addLocationStrategyAndWait
addScript
addScriptAndWait
addSelection
addSelectionAndWait
allowNativeXpath
allowNativeXpathAndWait
altKeyDown
altKeyDownAndWait
altKeyUp
altKeyUpAndWait
answerOnNextPrompt
assertAlert
assertAlertNotPresent
assertAlertPresent
assertAllButtons
assertAllFields
assertAllLinks
assertAllWindowIds
assertAllWindowNames
assertAllWindowTitles
assertAttribute
assertAttributeFromAllWindows
assertBodyText
assertChecked
assertConfirmation
assertConfirmationNotPresent
assertConfirmationPresent
assertCookie
assertCookieByName
assertCookieNotPresent
assertCookiePresent
assertCursorPosition
assertEditable
assertElementHeight
assertElementIndex
assertElementNotPresent
assertElementPositionLeft
assertElementPositionTop
assertElementPresent
assertElementWidth
assertEval
assertExpression
assertHtmlSource
assertLocation
assertMouseSpeed
assertNotAlert
assertNotAllButtons
assertNotAllFields
assertNotAllLinks
assertNotAllWindowIds
assertNotAllWindowNames
assertNotAllWindowTitles
assertNotAttribute
assertNotAttributeFromAllWindows
assertNotBodyText
assertNotChecked
assertNotConfirmation
assertNotCookie
assertNotCookieByName
assertNotCursorPosition
assertNotEditable
assertNotElementHeight
assertNotElementIndex
assertNotElementPositionLeft
assertNotElementPositionTop
assertNotElementWidth
assertNotEval
assertNotExpression
assertNotHtmlSource
assertNotLocation
assertNotMouseSpeed
assertNotOrdered
assertNotPrompt
assertNotSelectOptions
assertNotSelectedId
assertNotSelectedIds
assertNotSelectedIndex
assertNotSelectedIndexes
assertNotSelectedLabel
assertNotSelectedLabels
assertNotSelectedValue
assertNotSelectedValues
assertNotSomethingSelected
assertNotSpeed
assertNotTable
assertNotText
assertNotTitle
assertNotValue
assertNotVisible
assertNotWhetherThisFrameMatchFrameExpression
assertNotWhetherThisWindowMatchWindowExpression
assertNotXpathCount
assertOrdered
assertPrompt
assertPromptNotPresent
assertPromptPresent
assertSelectOptions
assertSelectedId
assertSelectedIds
assertSelectedIndex
assertSelectedIndexes
assertSelectedLabel
assertSelectedLabels
assertSelectedValue
assertSelectedValues
assertSomethingSelected
assertSpeed
assertTable
assertText
assertTextNotPresent
assertTextPresent
assertTitle
assertValue
assertVisible
assertWhetherThisFrameMatchFrameExpression
assertWhetherThisWindowMatchWindowExpression
assertXpathCount
assignId
assignIdAndWait
break
captureEntirePageScreenshot
captureEntirePageScreenshotAndWait
check
checkAndWait
chooseCancelOnNextConfirmation
chooseOkOnNextConfirmation
chooseOkOnNextConfirmationAndWait
click
clickAndWait
clickAt
clickAtAndWait
close
contextMenu
contextMenuAndWait
contextMenuAt
contextMenuAtAndWait
controlKeyDown
controlKeyDownAndWait
controlKeyUp
controlKeyUpAndWait
createCookie
createCookieAndWait
deleteAllVisibleCookies
deleteAllVisibleCookiesAndWait
deleteCookie
deleteCookieAndWait
deselectPopUp
deselectPopUpAndWait
doubleClick
doubleClickAndWait
doubleClickAt
doubleClickAtAndWait
dragAndDrop
dragAndDropAndWait
dragAndDropToObject
dragAndDropToObjectAndWait
dragdrop
dragdropAndWait
echo
fireEvent
fireEventAndWait
focus
focusAndWait
goBack
goBackAndWait
highlight
highlightAndWait
ignoreAttributesWithoutValue
ignoreAttributesWithoutValueAndWait
keyDown
keyDownAndWait
keyPress
keyPressAndWait
keyUp
keyUpAndWait
metaKeyDown
metaKeyDownAndWait
metaKeyUp
metaKeyUpAndWait
mouseDown
mouseDownAndWait
mouseDownAt
mouseDownAtAndWait
mouseDownRight
mouseDownRightAndWait
mouseDownRightAt
mouseDownRightAtAndWait
mouseMove
mouseMoveAndWait
mouseMoveAt
mouseMoveAtAndWait
mouseOut
mouseOutAndWait
mouseOver
mouseOverAndWait
mouseUp
mouseUpAndWait
mouseUpAt
mouseUpAtAndWait
mouseUpRight
mouseUpRightAndWait
mouseUpRightAt
mouseUpRightAtAndWait
open
openWindow
openWindowAndWait
pause
refresh
refreshAndWait
removeAllSelections
removeAllSelectionsAndWait
removeScript
removeScriptAndWait
removeSelection
removeSelectionAndWait
rollup
rollupAndWait
runScript
runScriptAndWait
select
selectAndWait
selectFrame
selectPopUp
selectPopUpAndWait
selectWindow
sendKeys
setBrowserLogLevel
setBrowserLogLevelAndWait
setCursorPosition
setCursorPositionAndWait
setMouseSpeed
setMouseSpeedAndWait
setSpeed
setSpeedAndWait
setTimeout
shiftKeyDown
shiftKeyDownAndWait
shiftKeyUp
shiftKeyUpAndWait
store
storeAlert
storeAlertPresent
storeAllButtons
storeAllFields
storeAllLinks
storeAllWindowIds
storeAllWindowNames
storeAllWindowTitles
storeAttribute
storeAttributeFromAllWindows
storeBodyText
storeChecked
storeConfirmation
storeConfirmationPresent
storeCookie
storeCookieByName
storeCookiePresent
storeCursorPosition
storeEditable
storeElementHeight
storeElementIndex
storeElementPositionLeft
storeElementPositionTop
storeElementPresent
storeElementWidth
storeEval
storeExpression
storeHtmlSource
storeLocation
storeMouseSpeed
storeOrdered
storePrompt
storePromptPresent
storeSelectOptions
storeSelectedId
storeSelectedIds
storeSelectedIndex
storeSelectedIndexes
storeSelectedLabel
storeSelectedLabels
storeSelectedValue
storeSelectedValues
storeSomethingSelected
storeSpeed
storeTable
storeText
storeTextPresent
storeTitle
storeValue
storeVisible
storeWhetherThisFrameMatchFrameExpression
storeWhetherThisWindowMatchWindowExpression
storeXpathCount
submit
submitAndWait
type
typeAndWait
typeKeys
typeKeysAndWait
uncheck
uncheckAndWait
useXpathLibrary
useXpathLibraryAndWait
verifyAlert
verifyAlertNotPresent
verifyAlertPresent
verifyAllButtons
verifyAllFields
verifyAllLinks
verifyAllWindowIds
verifyAllWindowNames
verifyAllWindowTitles
verifyAttribute
verifyAttributeFromAllWindows
verifyBodyText
verifyChecked
verifyConfirmation
verifyConfirmationNotPresent
verifyConfirmationPresent
verifyCookie
verifyCookieByName
verifyCookieNotPresent
verifyCookiePresent
verifyCursorPosition
verifyEditable
verifyElementHeight
verifyElementIndex
verifyElementNotPresent
verifyElementPositionLeft
verifyElementPositionTop
verifyElementPresent
verifyElementWidth
verifyEval
verifyExpression
verifyHtmlSource
verifyLocation
verifyMouseSpeed
verifyNotAlert
verifyNotAllButtons
verifyNotAllFields
verifyNotAllLinks
verifyNotAllWindowIds
verifyNotAllWindowNames
verifyNotAllWindowTitles
verifyNotAttribute
verifyNotAttributeFromAllWindows
verifyNotBodyText
verifyNotChecked
verifyNotConfirmation
verifyNotCookie
verifyNotCookieByName
verifyNotCursorPosition
verifyNotEditable
verifyNotElementHeight
verifyNotElementIndex
verifyNotElementPositionLeft
verifyNotElementPositionTop
verifyNotElementWidth
verifyNotEval
verifyNotExpression
verifyNotHtmlSource
verifyNotLocation
verifyNotMouseSpeed
verifyNotOrdered
verifyNotPrompt
verifyNotSelectOptions
verifyNotSelectedId
verifyNotSelectedIds
verifyNotSelectedIndex
verifyNotSelectedIndexes
verifyNotSelectedLabel
verifyNotSelectedLabels
verifyNotSelectedValue
verifyNotSelectedValues
verifyNotSomethingSelected
verifyNotSpeed
verifyNotTable
verifyNotText
verifyNotTitle
verifyNotValue
verifyNotVisible
verifyNotWhetherThisFrameMatchFrameExpression
verifyNotWhetherThisWindowMatchWindowExpression
verifyNotXpathCount
verifyOrdered
verifyPrompt
verifyPromptNotPresent
verifyPromptPresent
verifySelectOptions
verifySelectedId
verifySelectedIds
verifySelectedIndex
verifySelectedLabel
verifySelectedLabels
verifySelectedValue
verifySelectedValues
verifySomethingSelected
verifySpeed
verifyTable
verifyText
verifyTextNotPresent
verifyTextPresent
verifyTitle
verifyValue
verifyVisible
verifyWhetherThisFrameMatchFrameExpression
verifyWhetherThisWindowMatchWindowExpression
verifyXpathCount
waitForAlert
waitForAlertNotPresent
waitForAlertPresent
waitForAllButtons
waitForAllFields
waitForAllLinks
waitForAllWindowIds
waitForAllWindowNames
waitForAllWindowTitles
waitForAttribute
waitForAttributeFromAllWindows
waitForBodyText
waitForChecked
waitForCondition
waitForConfirmation
waitForConfirmationNotPresent
waitForConfirmationPresent
waitForCookie
waitForCookieByName
waitForCookieNotPresent
waitForCookiePresent
waitForCursorPosition
waitForEditable
waitForElementHeight
waitForElementIndex
waitForElementNotPresent
waitForElementPositionLeft
waitForElementPositionTop
waitForElementPresent
waitForElementWidth
waitForEval
waitForExpression
waitForFrameToLoad
waitForHtmlSource
waitForLocation
waitForMouseSpeed
waitForNotAlert
waitForNotAllButtons
waitForNotAllFields
waitForNotAllLinks
waitForNotAllWindowIds
waitForNotAllWindowNames
waitForNotAllWindowTitles
waitForNotAttribute
waitForNotAttributeFromAllWindows
waitForNotBodyText
waitForNotChecked
waitForNotConfirmation
waitForNotCookie
waitForNotCookieByName
waitForNotCursorPosition
waitForNotEditable
waitForNotElementHeight
waitForNotElementIndex
waitForNotElementPositionLeft
waitForNotElementPositionTop
waitForNotElementWidth
waitForNotEval
waitForNotExpression
waitForNotHtmlSource
waitForNotLocation
waitForNotMouseSpeed
waitForNotOrdered
waitForNotPrompt
waitForNotSelectOptions
waitForNotSelectedId
waitForNotSelectedIds
waitForNotSelectedIndex
waitForNotSelectedIndexes
waitForNotSelectedLabel
waitForNotSelectedLabels
waitForNotSelectedValue
waitForNotSelectedValues
waitForNotSomethingSelected
waitForNotSpeed
waitForNotTable
waitForNotText
waitForNotTitle
waitForNotValue
waitForNotVisible
waitForNotWhetherThisFrameMatchFrameExpression
waitForNotWhetherThisWindowMatchWindowExpression
waitForNotXpathCount
waitForOrdered
waitForPageToLoad
waitForPopUp
waitForPrompt
waitForPromptNotPresent
waitForPromptPresent
waitForSelectOptions
waitForSelectedId
waitForSelectedIds
waitForSelectedIndex
waitForSelectedIndexes
waitForSelectedLabel
waitForSelectedLabels
waitForSelectedValue
waitForSelectedValues
waitForSomethingSelected
waitForSpeed
waitForTable
waitForText
waitForTextNotPresent
waitForTextPresent
waitForTitle
waitForValue
waitForVisible
waitForWhetherThisFrameMatchFrameExpression
waitForWhetherThisWindowMatchWindowExpression
waitForXpathCount
windowFocus
windowFocusAndWait
windowMaximize
windowMaximizeAndWait

 
Selenium IDE (Integrated Development Environment) is the simplest tool in the Selenium Suite. It is a Firefox add-on that creates tests very quickly through its record-and-playback functionality. This feature is similar to that of QTP. It is effortless to install and easy to learn.

Because of its simplicity, Selenium IDE should only be used as a prototyping tool – not an overall solution for developing and maintaining complex test suites.

Though you will be able to use Selenium IDE without prior knowledge in programming, you should at least be familiar with HTML, JavaScript, and the DOM (Document Object Model) to utilize this tool to its full potential. Knowledge of JavaScript will be required when we get to the section about the Selenese command “runScript”.

Selenium IDE supports autocomplete mode when creating tests. This feature serves two purposes:

  • It helps the tester to enter commands more quickly.

  • It restricts the user from entering invalid commands.


To download the Latest version of Selenium IDE click here.

 Installation of Selenium IDE


What you need:

  • Mozilla Firefox

  • Active internet connection


If you do not have Mozilla Firefox yet, you can download it from Mozilla Firefox
Steps


  1. Launch Firefox and navigate to http://seleniumhq.org/download/. Under the Selenium IDE section, click on the link that shows the current version number.ide veriosn

  2. For security, a Firefox notification will pop up. Click on “Allow.”allow

  3. Wait until Firefox completes the download and then click “Install Now.”ideinstallation

  4. Wait until installation is completed. In the pop-up window, click “Restart Now.” restart

  5. After Firefox has restarted, launch Selenium IDE using either of two ways:

    • By pressingCtrl+Alt+S

    • By clicking on theFirefox Tools menu > Web Developer> Selenium IDE



  6. Selenium IDE should launch as shown idelaunch


 
Features of Selenium IDE:

idedetails
Menu Bar

It is located at the topmost portion of the IDE. The most commonly used menus are the File, Edit, and Options menus.

File menu: It contains options to create, open, save, and close tests.

Tests are saved in HTML format.

The most useful option is “Export” because it allows you to turn your Selenium IDE test cases into file formats that can run on Selenium Remote Control and WebDriver

“Export Test Case As…” will export only the currently opened test case.

“Export Test Suite As…” will export all the test cases in the currently opened test suite.

optiondetails

 

As of Selenium IDE v1.9.1, test cases can be exported only to the following formats:

  • .cs (C# source code)

  • .java (Java source code)

  • .py (Python source code)

  • .rb (Ruby source code)


testcase export

 
Edit Menu

It contains usual options like Undo, Redo, Cut, Copy, Paste, Delete, and Select All.

The two most important options are the “Insert New Command” and “Insert New Comment”.edit

 

The newly inserted command or comment will be placed on top of the currently selected line.inserted command

 

  • Commands are colored black.

  • Comments are colored purple.comments


Options menu

It provides the interface for configuring various settings of Selenium IDE.

We shall concentrate on the Options and Clipboard Format options.

optionsmenu clipboard


For example, when you choose Java/JUnit 4/WebDriver as your clipboard format, every Selenese command you copy from Selenium IDE’s editor will be pasted as Java code. See the illustration below.

example
Options dialog box

You can launch the Selenium IDE Options dialog box by clicking Options > Options… on the menu bar. Though there are many settings available, we will concentrate on the few important ones.

optionsdialog

Default Timeout Value:

This refers to the time that Selenium has to wait for a certain element to appear or become accessible before it generates an error.  Default timeout value is 30000ms.

Selenium IDE extensions:

This is where you specify the extensions you want to use to extend Selenium IDE’s capabilities. You can visit http://addons.mozilla.org/en-US/firefox/and use “Selenium” as keyword to search for specific extensions.

Remember base URL:

Keep this checked if you want Selenium IDE to remember the Base URL every time you launch it. If you uncheck this, Selenium IDE will always launch with a blank value for the Base URL.

Auto start record

If you check this, Selenium IDE will immediately record your browser actions  upon startup.

 Locator builders:

This is where you specify the order by which locators are generated while recording. Locators are ways to tell Selenium IDE which UI element a Selenese command should act upon. In the setup below, when you click on an element with an ID attribute, that element’s ID will be used as the locator since “id” is the first one in the list. If that element does not have an ID attribute, Selenium will next look for the “name” attribute since it is second in the list. The list goes on and on until an appropriate one is found.

opt
Base URL Bar

baseurl

It has a dropdown menu that remembers all previous values for easy access.

The Selenese command “open” will take you to the URL that you specified in the Base URL.

In this tutorial series, we will be using http://newtours.demoaut.com as our Base URL. It is the site for Mercury Tours, a web application maintained by HP for web testing purposes. We shall be using this application because it contains a complete set of elements that we need for the succeeding topics.

The Base URL is very useful in accessing relative URLs. Suppose that your Base URL is set to http://newtours.demoaut.com. When you execute the command “open” with the target value “signup”, Selenium IDE will direct the browser to http://newtours.demoaut.com/signup. See the illustration below.

baseu

 
Toolbar

toolbar

 

testcaspane

 
Editor

You can think of the editor as the place where all the action happens. It is available in two views: Table and Source.

source

 

1 2



Log Pane

The Log Pane displays runtime messages during execution. It provides real-time updates as to what Selenium IDE is doing.

 Logs are categorized into four types:

  • Debug – By default, Debug messages are not displayed in the log panel. They show up only when you filter them. They provide technical information about what Selenium IDE is doing behind the scenes. It may display messages such as a specific module has done loading, a certain function is called, or an external JavaScript file was loaded as an extension.

  • Info – It says which command Selenium IDE is currently executing.

  • Warn – These are warning messages that are encountered in special situations.

  • Error – These are error messages generated when Selenium IDE fails to execute a command, or if a condition specified by “verify” or “assert” command is not met.


log

Logs can be filtered by type. For example, if you choose to select the “Error” option from the dropdown list, the Log Pane will show error messages only.

logfilter

 
Reference Pane

The Reference Pane shows a concise description of the currently selected Selenese command in the Editor. It also shows the description about the locator and value to be used on that command.

reference

 
UI-Element Pane

The UI-Element is for advanced Selenium users. It uses JavaScript Object Notation (JSON) to define element mappings. The documentation and resources are found in the “UI Element Documentation” option under the Help menu of Selenium IDE.

ui

An example of a UI-element screen is shown below.Uiexample
Rollup Pane

Rollup allows you to execute a group of commands in one step. A group of commands is simply called as a “rollup.” It employs heavy use of JavaScript and UI-Element concepts to formulate a collection of commands that is similar to a “function” in programming languages.

Rollups are reusable; meaning, they can be used multiple times within the test case. Since rollups are groups of commands condensed into one, they contribute a lot in shortening your test script.

roll

An example of how the contents of the rollup tab look like is shown below.

rollexample

 

Summary


Selenium IDE (Integrated Development Environment) is the simplest tool in the Selenium Suite.

It must only be used as a prototyping tool.

Knowledge of JavaScript and HTML is required for intermediate topics such as executing the “runScript” and “rollup” commands. A rollup is a collection of commands that you can reuse to shorten your test scripts significantly. Locators are identifiers that tell Selenium IDE how to access an element.

Firebug (or any similar add-on) is used to obtain locator values.

The menu bar is used in creating, modifying, and exporting test cases into formats useable by Selenium RC and WebDriver.

The default format for Selenese commands is HTML.

The “Options” menu provides access to various configurations for Selenium IDE.

The Base URL is useful in accessing relative URLs.

The Test Case Pane shows the list of currently opened test cases and a concise summary of test runs.

The Editor provides the interface for your test scripts.

The Table View shows your script in tabular format with “Command”, “Target”, and “Value” as the columns.

The Source View shows your script in HTML format.

The Log and Reference tabs give feedback and other useful information when executing tests.

The UI-Element and Rollup tabs are for advanced Selenium IDE users only. They both require considerable effort in coding JavaScript.

UI-Element allows you to conveniently map UI elements using JavaScript Object Notation (JSON).

 

Important Things to Note When Using Other Formats in Source View

21


Selenium IDE works well only with HTML – other formats are still in experimental mode. It is NOT advisable to create or edit tests using other formats in Source View because there is still a lot of work needed to make it stable. Below are the known bugs as of version 1.9.1.

You will not be able to perform playback nor switch back to Table View unless you revert to HTML.

The only way to add commands safely on the source code is by recording them.

When you modify the source code manually, all of it will be lost when you switch to another format.

Though you can save your test case while in Source View, Selenium IDE will not be able to open it.

The recommended way to convert Selenese tests is to use the “Export Test Case As…” option under the File menu, and not through the Source View.

Summary

  • Test scripts can be created either by recording or typing the commands and parameters manually.

  • When creating scripts manually, Firebug is used to get the locator.

  • The Find button is used to check that the command is able to access the correct element.

  • Table View displays a test script in tabular form while Source View displays it in HTML format.

  • Changing the Source View to a non-HTML format is still experimental.

  • Do not use the Source View in creating tests in other formats. Use the Export features instead.

  • Parameters are not required all the time. It depends upon the command.

  • There are three types of commands:

    • Actions – directly interacts with page elements

    • Accessors – “reads” an element property and stores it in a variable

    • Assertions – compares an actual value with an expected one





  • Assertions have three types:

    • Assert – upon failure, succeeding steps are no longer executed

    • Verify – upon failure, succeeding steps are still executed.

    • WaitFor – passes if the specified condition becomes true within the timeout period; otherwise, it will fail





  • The most common commands are:

    • open

    • Click/clickAndWait

    • type/typeKeys

    • verifyTitle/assertTitle

    • verifyTextPresent

    • verifyElementPresent

    • verifyTable

    • waitForPageToLoad

    • waitForElementPresent