Assert & Verify in Selenium IDE

โšก Smart Summary

Selenium IDE with Scripts and Commands lets testers record, edit, and replay browser actions using Selenese โ€” the IDE’s lightweight command language. This article covers recording a script, writing Selenese manually, choosing between Assert and Verify, and debugging with breakpoints.

  • ๐ŸŽฌ Record First: Selenium IDE captures clicks, inputs, and assertions automatically while you operate the browser.
  • ๐Ÿงฉ Selenese Language: Each command has a command name, optional target, and optional value โ€” never more than two parameters.
  • ๐Ÿ›‘ Assert vs Verify: Assert stops the test on failure; Verify logs the failure and continues with the next step.
  • ๐Ÿ” Three Command Types: Actions interact with the page, Accessors read state into variables, Assertions check conditions.
  • ๐Ÿž Debug Aids: Use Execute Command, Start Point, Breakpoints, and Step to inspect or rerun a single command at a time.
  • ๐Ÿค– AI Boost: AI testing tools auto-generate Selenese, suggest robust locators, and convert IDE scripts into Selenium WebDriver code.

How to Crack (Hack) a Password?

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 base URL is https://demo.guru99.com/test/newtours/.

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

Note: This tutorial uses the classic Firefox-only Selenium IDE 1.x with Firebug to introduce Selenese fundamentals. Firebug was retired in Firefox 57, and the modern Selenium IDE is now a Chrome / Firefox / Edge browser extension with a different UI. The Selenese concepts, command types, and debugging features below still apply directly to the new IDE.

Create a Script by Recording

Step 1)

  • Launch Firefox and Selenium IDE.
  • Type the value for our Base URL: https://demo.guru99.com/test/newtours/.
  • Toggle the Record button on (if it is not toggled on by default).

Selenium IDE with Base URL set and Record button toggled on

Step 2) In Firefox, navigate to https://demo.guru99.com/test/newtours/. Firefox should land on a page similar to the one below.

Mercury Tours homepage in Firefox

Step 3)

  • Right-click on any blank space within the page โ€” for example, on the Mercury Tours logo in the upper-left corner. This brings up the Selenium IDE context menu. Do not click on any hyperlinked objects or images.
  • Select the Show Available Commands option.
  • Choose assertTitle exact: Welcome: Mercury Tours. This command checks that the page title is correct.

Selenium IDE context menu with Show Available Commands

Selenium IDE editor showing assertTitle command added

Step 4)

  • In the User Name text box of Mercury Tours, type the invalid username invalidUNN.
  • In the Password text box, type the invalid password invalidPWD.

Invalid username typed into Mercury Tours form

Invalid password typed into Mercury Tours form

Step 5) Click the Sign-In button. Firefox should land on the page shown below.

Mercury Tours sign-in failure page

Step 6) Toggle the Record button off to stop recording. Your script should now resemble the one below.

Selenium IDE recorded script after stopping the recorder

Step 7) Now save the recorded test script. In the File menu, choose Save Test Case, or press Ctrl+S.

Save Test Case option in the Selenium IDE File menu

Step 8)

  • Choose a destination folder, then name the test case Invalid_login.
  • Click Save.

Save dialog naming the Selenium IDE test case Invalid_login

Step 9) Notice that the file is saved as HTML.

Saved test case file with HTML extension

Step 10) Return to Selenium IDE and click the Playback button to execute the whole script. Selenium IDE replays every action faithfully.

Selenium IDE Playback button executing the recorded script

Introduction to Selenium Commands โ€“ Selenese

Selenese is the script language that drives Selenium IDE. The rules are simple:

  • Each Selenese command accepts up to two parameters โ€” a target and a value.
  • Parameters are not always required. The number depends on the command.

Types of Commands

Selenese groups commands into three categories. Each one has a different role in the script.

Actions Commands that directly interact with page elements. Example: click interacts with the element you click; type puts a value into a text box and the text box echoes it back, giving a two-way interaction.
Accessors Commands that store a value into a variable. Example: storeTitle only reads the page title and saves it โ€” it does not change anything on the page.
Assertions Commands that verify a condition. Selenese exposes three assertion flavours: Assert stops the test on failure, Verify logs the failure and continues, and WaitFor pauses until a condition becomes true (default timeout 30 seconds, configurable under Options > General).

Assert vs. Verify in Selenium

The diagrams below contrast the runtime behaviour of an Assert versus a Verify command when the check fails mid-test.

Assert command behaviour stopping the test on failure

Verify command behaviour continuing the test after a logged failure

Common Commands

Command Number of Parameters Description
open 0โ€“2 Opens a page using a URL.
click / clickAndWait 1 Clicks a specified element.
type / typeKeys 2 Types a sequence of characters.
verifyTitle / assertTitle 1 Compares the actual page title with an expected value.
verifyTextPresent 1 Checks if a given text is found within the page.
verifyElementPresent 1 Checks the presence of a specific element.
verifyTable 2 Compares the contents of a table with expected values.
waitForPageToLoad 1 Pauses execution until the page finishes loading.
waitForElementPresent 1 Pauses execution until the specified element appears.

Create a Script Manually with Firebug

Let us now recreate the same test case manually by typing the commands. This walkthrough uses Firebug to inspect element locators. (In the modern Selenium IDE, use the browser’s built-in DevTools instead of Firebug.)

Step 1) Open Firefox and Selenium IDE. Type the base URL https://demo.guru99.com/test/newtours/. The Record button must be OFF.

Selenium IDE Record toggle in OFF state

Step 2) Click the topmost blank line in the Editor.

Selecting the first blank row in the Selenium IDE editor

Type open in the Command text box and press Enter.

Open command entered in the Selenium IDE command field

Step 3) Navigate Firefox to the base URL and activate Firebug. In the IDE Editor, select the line below the open command and type assertTitle. Use the autocomplete suggestions for accuracy.

Autocomplete suggestions for assertTitle in Selenium IDE

Step 4) In Firebug, expand the <head> tag to reveal the <title>. Click the title value (Welcome: Mercury Tours) and paste it into the Target field in the Editor.

Copying the page title from Firebug into the IDE target field

Step 5) Click the third blank line in the Editor and type type in the Command field. In Firebug, click the Inspect button.

Type command being added in Selenium IDE editor

Click on the User Name text box. Firebug shows the matching HTML element automatically.

Firebug inspecting the User Name field on Mercury Tours

Step 6) The User Name text box has no ID, but it has a NAME attribute. Copy the NAME value and paste it into the Target field of Selenium IDE.

Copying the User Name field NAME attribute

Still in the Target field, prefix userName with name= so Selenium IDE targets the element whose NAME attribute is userName.

Selenium IDE target field with name=userName locator

Type invalidUN in the Value field. Your script now has its third command. Selenium IDE is case-sensitive, so type values and attribute names exactly as they appear in the application.

Type command targeting name=userName with value invalidUN

Step 7) Add a fourth command by typing type in the Command field. Use Firebug’s Inspect button on the Password text box.

Firebug inspecting the Password field

Paste the NAME attribute (password) into the Target field, prefix with name=, and set the Value to invalidPW.

Selenium IDE script after adding the password type command

Step 8) Add the fifth command by typing clickAndWait in the Command field. Use Firebug’s Inspect on the Sign-In button.

Firebug inspecting the Sign-In button

Paste the NAME value (login) into the Target field with the name= prefix.

Final manual Selenium IDE script with five commands

Step 9) Save the test case as before.

Using the Find Button

The Find button in Selenium IDE confirms that the value entered in the Target field actually matches a UI element on the page.

Open the Invalid_login test case from the previous section and click any command with a Target entry โ€” for example, the third command.

Find button next to the Target field in Selenium IDE

Click Find. The User Name text box on the Mercury Tours page becomes highlighted briefly.

User Name field highlighted in Firefox after clicking Find

The highlight confirms that Selenium IDE resolved the locator correctly. If the wrong element (or no element) is highlighted, the locator in the script needs to be corrected.

Execute Command

Execute Command runs a single line of the script without running the whole test case. Click the line you want to run and either choose Actions > Execute this command from the menu or press X on the keyboard.

Step 1) Make sure the browser is on the Mercury Tours homepage. Click the line you wish to run โ€” for example, type | userName | invalidUN.

Type command selected for execution in Selenium IDE

Step 2) Press X on the keyboard.

Step 3) The username text box on the page is populated with invalidUN.

Username field populated after Execute Command

Executing commands this way depends on the page that Firefox is currently displaying. Running the same command on Google’s homepage would fail because there is no field named userName there.

Start Point

A start point tells Selenium IDE which line to begin execution from. The shortcut key is S.

Start point set on a Selenium IDE script line

In the example above, playback starts on the third line (type | password | invalidPW). A test script can have only one start point. Like Execute Command, the start point depends on the currently displayed page and fails if the page is wrong.

Breakpoints

Breakpoints tell Selenium IDE to pause the test automatically at a given line. The shortcut key is B.

Breakpoint indicator on a Selenium IDE script line

The yellow highlight shows the paused step. A test case can have multiple breakpoints.

Step

The Step command runs the next line after a paused test case. Use it together with breakpoints to walk through a script one command at a time.

Test paused at clickAndWait before clicking Step

Before clicking Step. The test case is paused on the line clickAndWait | login.

Test advanced to next command after clicking Step

After clicking Step. The clickAndWait | login command runs and execution pauses on the next command (verifyTitle | Sign-on: Mercury Tours). The next line pauses even without a breakpoint โ€” that is the purpose of Step.

Important Things to Note When Using Other Formats in Source View

Caution warning about non-HTML source view formats

Selenium IDE 1.x works reliably only with the HTML format โ€” other formats are still experimental. Creating or editing tests in non-HTML Source View is not recommended. The known issues as of version 1.9.1 are:

  • You cannot use Playback or switch back to Table View without reverting to HTML.
  • The safest way to add commands in Source View is by recording them.
  • Manual edits in Source View are lost when you switch to another format.
  • You can save a test case in Source View, but Selenium IDE may fail to reopen it.

The recommended way to convert Selenese tests to other languages is the File > Export Test Case Asโ€ฆ menu, not the Source View.

FAQs

The legacy Firefox-only Selenium IDE 1.x is no longer maintained. The modern Selenium IDE is a browser extension for Chrome, Firefox, and Edge from selenium.dev, supporting record-and-playback plus export to WebDriver code.

Use Assert for hard preconditions where the test cannot continue (for example, the right page must load first). Use Verify when later checks still add value even if the current one fails, such as verifying multiple fields on a form.

Firebug was retired in Firefox 57. Use the browser’s built-in DevTools (F12) or extensions such as SelectorsHub, ChroPath, or Playwright Inspector to capture XPath and CSS locators for Selenium scripts.

Yes. AI test platforms watch user sessions, generate Selenese commands, suggest robust locators, and convert recorded scripts into Selenium WebDriver code in Java, Python, or JavaScript with much less manual effort.

Generative AI examines DOM snapshots and proposes locators less likely to break โ€” preferring data-test attributes over brittle XPath. Self-healing AI agents automatically rewrite locators after UI changes, keeping Selenium IDE scripts green.

Summarize this post with: