Getting started with Selenium IDE - Part 2

Friday, 03 August 2007

Posted by Sébastien Lachance with Comments (0)

Here is the second part of the Getting Start with Selenium IDE series. This part mainly cover the start of the test. The next part will feature the fun part, testing everything! Enjoy!!!

Structure of an html test An html test is basically an html table. Each row is a command and each column has a specific purpose.

Command Target Value
clickAndWait link=Open  
type txtUser MyUsername
type txtPassword MyPassword

The Command column contains the command to be executed. Nothing more.

The Target column is the element on the page on which the command will be executed, but sometime it can have an other purpose like the pause command.

And finally the Value column contains the value on which something will be tested. By example, you can have the assertNotText command and the value column will be the text that should not be there.

First command of the test

With that being said, let's start with some concrete stuff. First of all, you will want to open your website. I recommend to use the Base URL text field, in case the root of your web site change. Enter your URL in the base URL text field. Then, add the first command of your test, which will be open, the target will be /startpage.html (replace startpage.html by your start page or leave it empty). Execute the test to verify that you are on the wanted page.

Command explanation

A command is a JavaScript function. Another way to see at the Target and Value column is that each one is a parameter of the function. Use the reference tab in your Selenium IDE to see which parameters are needed.

selenium-reference

Command action and ActionAndWait

There is various command available and much of the action have an equivalent with the AndWait suffix. The action without the AndWait suffix will be executed by the test runner and go directly to the next. However, there is scenario where a postback will occur after a command and the page will no longer be available for seconds. This is where you need to use the command ending with AndWait. Then the action will be executed and when the page has returned from the server the next command will be executed. Selenium IDE Getting Started Series

Great resource




blog comments powered by Disqus