Software Testing Class

Learn Selenium Series – How To Enhance A Script Using Selenium IDE

In the previous class, we learned about . In this chapter, we are going to discuss the commands which will help us to do our automation script easily.

In the below example on Selenium IDE, we are testing Facebook login URL. On this page, we are verifying two commands for Target id=email and id=xyz. Considering the scenarios and function of the above two commands below is the test output. It is to be noted that on Facebook login page id=email is present, but id=xyz is not present, hence the output.

Selenium IDE Screen1
Click image to enlarge.

In the below example on Selenium IDE, we are testing Facebook login URL. On this page, we are verifying the above two commands for texts as ‘Facebook’ and ‘Twitter’. Considering the scenarios and function of the above two commands below is the test output. It is to be noted that on the Facebook login page, the text as ‘Facebook’ is present but the text as ‘Twitter’ is not present. Hence the output.

Click image to enlarge.

In the below example on Selenium IDE, we are testing Facebook login URL. On this page, we are verifying two commands for a position of GUI element id=email. Considering the scenarios and function of the above two commands below is the test output. It is to be noted that on the Facebook login page, the position of GUI element id=email is not matching the value in pixels measured for a top and left of the page, hence the output.

Click image to enlarge.

Given below is the demonstration of the failed attempt to login on Facebook using Selenium IDE.

Click image to enlarge.
Click image to enlarge.

In the below example, on the Facebook login page, we are looking for elements id=email (which is present) and id=gmail (which is not present). We are storing the Boolean output of command ‘StoreElementPresent’ in variables myVal1 and myVal2. When this test is executed on Selenium IDE, both of these variables with getting value as TRUE and FALSE respectively as a former element is present on the web page, however, the latter element is absent on the web page, hence the result as shown below.

Here ‘echo’ command is used to echo the values of the variables which are present in the test log.

Click image to enlarge.

In the below example, we are storing inner HTML text for h1 tag (css=h1) into a variable ‘var’ that has a ‘Facebook logo’. When we echo this variable (echo ${var}), the Selenium IDE logs will display this value as shown below.

Click image to enlarge.
Commands Description
assertAlert & assertNotAlert These commands are used to retrieve the message of the alert and assert it to a string value that we have specified for a system and is under test.
assertAlertPresent &

assertAlertNotPresent

These commands are used to assert if an Alert is present or not. They return Boolean values as TRUE or FALSE.
storeAlert This command is used to retrieve the alert message and stores it in a variable that we have specified.
storeAlertPresent This command returns a TRUE value if an alert is present. Otherwise, it returns a FALSE value.
verifyAlert & verifyNotAlert These commands are used to retrieve the message of the alert and verify if it is equal to the string value that we have specified.
verifyAlertPresent

&verifyAlertNotPresent

These commands are used to verify that if an Alert is present or not. They return Boolean values as TRUE or FALSE.
Commands Description
assertConfirmation

& assertNotConfirmation

These commands are used to retrieve the message of the confirmation and asserts it to a string value that we have specified for the system and are under test.
assertConfirmationPresent &

assertConfirmationNotPresent

These commands are used to assert if confirmation is present or not. They return Boolean values as TRUE or FALSE.
storeConfirmation This command is used to retrieve the confirmation message and stores it in a variable that we have specified.
storeConfirmationPresent This command returns a TRUE value if confirmation is present. Otherwise, it returns a FALSE value.
verifyConfirmation& verifyNotConfirmation These commands are used to retrieve the message of the confirmation and verify if it is equal to the string value that we have specified.
verifyConfirmationPresent

&verifyConfirmationNotPresent

These commands are used to verify that if confirmation is present or not. They return Boolean values as TRUE or FALSE.

Step 1: First transfer the control from the parent window to the newly launched window using the “selectWindow” command and its title as the locator.

Step 2: Verify the title of the new window is as expected.

Step 3: Access the elements of the newly launched window and run tests on it. Once completed then next, select back the original window using the “selectWindow” command again and “null” as its target.

Step 4: Verify the title of the currently selected window is as expected and resume our tests.

*******************************************

Want to start learning complete Selenium

Chekout Selnium Tutorial Series

***************************************************

If you are not a regular reader of this website then highly recommends you to Sign up for our free email newsletter!! Sign up just providing your email address below:

Enter your email address:

Check the email in your inbox for confirmation to get the latest updates Software Testing for free.

Happy Testing!!!

Exit mobile version