Selenium – IDE Editing Test Steps and Adding Verification Points

You can not only edit the steps inside the selenium IDE but you can also add new steps or change the sequence of steps inside the IDE itself.

To do that we need to understand the following –

Test Case Table Pane – Your script is displayed in the test case pane. It has two tabs, one for displaying the command and their parameters in a readable “table” format as shown below.

Test Case Source Pane – Source displays the test case in the native format in which the file will be stored. By default this is HTML although it can be changed to a programming language such as Java or C# or a scripting language like Python.

Operations Pane – The Command, Target and value entry fields display the currently selected command along with its parameters. User can modify command, Target or value in this pane.

Also if you select Reference Tab you will see details on the command and arguments that should be entered for that command.

Adding Verification Points

One crucial part of any test case is the verification of your results against expected results. Your test cases will also need to check the properties of a web page. To do the same in your script you can insert assert or very commands in selenium IDE. Both the commands work to compare results, with different outcome to the failure of a test condition.

  • Assert – assert will fail the test and abort the current test case.
  • Verify – verify will fail the test and continue to run the test case.

Step 1. Open your IDE test case MYFirstIDEScript

Step 2. Click on File > Save Test case As  and enter MyIDEVerificationScript

Step 3. Select step where you want insert verification point

Step 4. Select Actions > Toggle Breakpoint to insert a breakpoint at that step.

Step 5. Run the test via Selenium IDE, you will notice that script runs until the clickAndWait link for automation tutorial.

Step 6. In the application you will notice that search result page is displaying for automationtutorial.com.

Step 7. Place your cursor on the search result link, right click and select Show All Available commands.

Step 8. Since we want to verify that link text is present or not. We will insert verifytext “link=AUTOMATION TUTORIAL | QTP, UFT & Selenium Online Tutorial” command.

In the IDE Script, you will notice a new statement added verifyText as shown below –

Step 9. Remove the breakpoint and Save the test script File > Save Test Case.

Step 10. you can re-run the test to confirm that verifytext  statement got executed correctly and verifies link presence.

Given below are the mostly used verification commands that help us check if a particular step has passed or failed.

  • verifyElementPresent
  • assertElementPresent
  • verifyElementNotPresent
  • assertElementNotPresent
  • verifyText
  • assertText
  • verifyAttribute
  • assertAttribute
  • verifyChecked
  • assertChecked
  • verifyAlert
  • assertAlert
  • verifyTitle
  • assertTitle

Synchronization Points

During script execution, the application might respond based on server load, hence it is required for the application and script to be in sync. Given below are few a commands that we can use to ensure that the script and application are in sync.

  • waitForAlertNotPresent
  • waitForAlertPresent
  • waitForElementPresent
  • waitForElementNotPresent
  • waitForTextPresent
  • waitForTextNotPresent
  • waitForPageToLoad
  • waitForFrameToLoad

Leave a Reply Cancel reply