Introduction to Store Variables, Echo, Alert, PopUp handling in Selenium IDE

Introduction to Store Variables, Echo, Alert, PopUp handling in Selenium IDE

Table of Contents

Store

Store command is used to store a text value in a variable. The below example saves the value example in a variable whose name is “abc.”

Introduction to Store Variables, Echo, Alert, PopUp handling in Selenium IDE

To use the value stored in a variable, we will enclose it in a ${ … } symbol.

Store Attribute

This command is used to access and store the value of the attribute name of the specific UI element on the web page.

Introduction to Store Variables, Echo, Alert, PopUp handling in Selenium IDE

Store Text

This command is used to access and store the text between HTML tags of the specific UI element on the web page.

Introduction to Store Variables, Echo, Alert, PopUp handling in Selenium IDE

Store Value

This command is used to access and store the value of the attribute value of the specific UI element on the web page.

Introduction to Store Variables, Echo, Alert, PopUp handling in Selenium IDE

Store Title

This command is used to access and store the title of the web page.

Introduction to Store Variables, Echo, Alert, PopUp handling in Selenium IDE

Echo

The primary purpose of this command is to print the messages given in Selenium IDE.

Alerts

Alerts are the simple form of pop-up windows. Some common Selenium IDE commands used for handling alerts:

Assert alert:

This command is used to check whether the alert is displayed on the web page or not.

Introduction to Store Variables, Echo, Alert, PopUp handling in Selenium IDE

While working on alert, we need to remember these two things:

  • Selenium IDE automatically clicks on the OK button of the alert window, and hence you cannot see the actual alert.
  • Selenium IDE does not handle alerts that are within the page’s onload() function. It only handles alerts that are generated after the complete loading of the web page.

Confirmations: 

Confirmations are another popups that show two options, an OK and a CANCEL button, while in alerts, only the OK button is present. Some of the commands that are used to handle confirmations are:

  • Assert confirmation: This command is used to check whether confirmation is displayed on the web page or not.
  • Webdriver choose OK on next confirmation: This command is used to select OK on the displayed confirmation box.
  • Webdriver choose cancel on next confirmation: This command is used to select cancel on the displayed confirmation box.
  • Choose cancel on next confirmation: This command is used to cancel the confirmation box before it is being displayed on the web page.
  • Choose OK on next confirmation: This command is used to accept the confirmation box before it is being displayed on the web page.

Multiple Windows 

If you click a link that launches a new window, you must first give instructions to Selenium IDE to select that window; first, you can only access the elements within it after you have instructed Selenium. For switching between windows, you need to use select window command.

To understand this, we will use http://jsbin.com/ocinaj/1, whose title is “First Window.” The “here” hyperlink found on the topmost portion of the web page will open Facebook in a new window.

One Response

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share this article
Subscribe
By pressing the Subscribe button, you confirm that you have read our Privacy Policy.
Need a Free Demo Class?
Join H2K Infosys IT Online Training
Enroll Free demo class