---
description: In this tutorial, we will learn, Store commands, Echo commands, Alerts and Popup handling, Confirmations and about Multiple Windows.
title: Store Variables, Echo, Alert, PopUp handling in Selenium IDE
image: https://www.guru99.com/images/store-variables-echo-alert-popup-in-selenium-ide.png
---

 

[Skip to content](#main) 

**⚡ Smart Summary**

Store commands in Selenium IDE save runtime values into named variables, echo prints them to the log, and a dedicated command family handles alerts, confirmation dialogs and switching between multiple browser windows.

* 🔘 **Create a variable:** The store command takes the value in Target and the variable name in Value.
* ☑️ **Read it back:** Wrap the name in ${ } wherever a command accepts a target or a value.
* ✅ **Print for debugging:** echo writes a literal string or a variable straight into the IDE log.
* 🧪 **Alerts are auto-accepted:** The IDE clicks OK for you, so use storeAlert to capture the message text.
* 🛠️ **Confirmations need a decision:** Place chooseOkOnNextConfirmation before the command that opens the dialog.
* 📊 **Window switching:** selectWindow targets a window title, and a null target returns to the parent window.

[ Read More ](javascript:void%280%29;) 

![Store variables, echo, alert and popup handling in Selenium IDE](https://www.guru99.com/images/store-variables-echo-alert-popup-in-selenium-ide.png) 

In this tutorial you will learn the store commands, the echo command, and alert and popup handling in [Selenium IDE](https://www.guru99.com/introduction-selenuim-ide.html). Together these commands turn a fixed recorded script into one that reacts to whatever the application returns at runtime.

**⚠️ A note on versions:** the screenshots below come from the original Firefox-plugin Selenium IDE, and the commands use its camelCase Selenese names. The current Chrome, Firefox and Edge extension keeps the same behaviour but writes most command names with spaces. A mapping table appears near the end of this article, and every original command and screenshot is preserved as published.

## Selenium IDE Variables

### Store

To store variables in Selenium IDE, we use the **store** command. The illustration below stores the value “tutorial” to a variable named “myVariable.”

[](https://www.guru99.com/images/image010.png)

To access the variable, simply enclose it in a ${ … } symbol. For example, to enter the value of “myVariable” into the “userName” textbox of Mercury Tours, enter ${myVariable} in the Value field.

[](https://www.guru99.com/images/image011.png)

## Echo Command in Selenium IDE

A stored variable is invisible until something prints it, and that is what the **echo** command does. It writes a message into the IDE log pane during playback, which makes it the quickest way to confirm that a store command captured what you expected before you build assertions on top of it.

The command accepts either form:

* **A literal string.** Put the text in the Target field, for example _Login step finished_, to mark a checkpoint in a long script.
* **A variable.** Put ${myVariable} in the Target field and the stored value is printed instead of the name.

Two habits make echo far more useful than it first appears. Print a variable immediately after the store command that creates it, so a failure is traced to the capture rather than to the assertion twenty steps later. And prefix each message with the step it belongs to, because the log pane shows every command in one flat list. Note that echo only writes to the log — it never changes the page and never fails a test, so it is safe to leave in a script permanently.

## StoreElementPresent

This command stores either “true” or “false” depending on the presence of the specified element. The script below stores the Boolean value “true” to “var1” and “false” to “var2”. To verify, we will use the echo command to display the values of var1 and var2\. The Base URL for the illustration below was set to the Mercury Tours homepage.

[](https://www.guru99.com/images/image012.png)

## StoreText

This command is used to store the inner text of an element into a variable. The illustration below stores the inner text of the h1 tag on the Facebook sign-up page into a variable named “textVar.”

[](https://www.guru99.com/images/image013.png)

Since it is the only element of its kind on the page, it is safe to use “css=h1” as our target. The image below shows that Selenium IDE was able to save the string “Sign Up” in the “textVar” variable, because echo printed its value correctly.

[](https://www.guru99.com/images/image014.png)

## Alerts, Popup, and Multiple Windows

Alerts are probably the simplest form of pop-up window. The most common Selenium IDE commands used in handling alerts are the following:

| Alerts                                           | Uses                                                                                                  |
| ------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
| **assertAlert** **assertNotAlert**               | retrieves the message of the alert and asserts it against a string value that you specified           |
| **assertAlertPresent** **assertAlertNotPresent** | asserts whether an alert is present or not                                                            |
| **storeAlert**                                   | retrieves the alert message and stores it in a variable that you specify                              |
| **storeAlertPresent**                            | returns TRUE if an alert is present, FALSE otherwise                                                  |
| **verifyAlert** **verifyNotAlert**               | retrieves the message of the alert and verifies whether it equals the string value that you specified |
| **verifyAlertPresent** **verifyAlertNotPresent** | verifies whether an alert is present or not                                                           |

Remember these two things when working with alerts:

* Selenium IDE automatically clicks the OK button of the alert window, so you will not be able to see the actual alert.
* Selenium IDE cannot handle alerts that fire inside the page’s onload() function. It only handles alerts that are generated after the page has completely loaded.

In this example we use the storeAlert command to show that even though Selenium IDE did not display the actual alert, it was still able to retrieve the message.

**Step 1)** In Selenium IDE, set the Base URL to http://jsbin.com. The full URL is http://jsbin.com/usidix. These jsbin snippets date from the Firefox-plugin era and may no longer resolve; any page with a button that raises an alert reproduces the same result.

**Step 2)** Create the script as shown below. The click command targets the Go! button, storeAlert captures the message into alertMessage, and echo prints it.

[](https://www.guru99.com/images/image015.png)

**Step 3)** Execute the script, and do not expect to see the actual alert. The log pane below shows the captured message even though the dialog was never visible.

[](https://www.guru99.com/images/image016.png)

### RELATED ARTICLES

* [UFT vs Selenium: Key Difference Between Them ](https://www.guru99.com/alm-qtp-selenium-difference.html "UFT vs Selenium: Key Difference Between Them")
* [How to Use Log4j in Selenium? ](https://www.guru99.com/tutorial-on-log4j-and-logexpert-with-selenium.html "How to Use Log4j in Selenium?")
* [How to Drag and Drop in Selenium (Example) ](https://www.guru99.com/drag-drop-selenium.html "How to Drag and Drop in Selenium (Example)")
* [Right Click and Double Click in Selenium ](https://www.guru99.com/double-click-and-right-click-selenium.html "Right Click and Double Click in Selenium")

## Confirmations

Confirmations are popups that give you an OK and a CANCEL button, as opposed to alerts, which give you only the OK button. The commands you can use in handling confirmations mirror the alert commands.

* assertConfirmation / assertNotConfirmation
* assertConfirmationPresent / assertConfirmationNotPresent
* storeConfirmation
* storeConfirmationPresent
* verifyConfirmation / verifyNotConfirmation
* verifyConfirmationPresent / verifyConfirmationNotPresent

In addition, these commands tell Selenium which button to choose, OK or CANCEL.

* chooseOkOnNextConfirmation / chooseOkOnNextConfirmationAndWait
* chooseCancelOnNextConfirmation

Place these commands **before** the command that triggers the confirmation box, so that Selenium IDE knows beforehand which option to choose. Again, you will not see the actual confirmation box during script execution.

Let us test a webpage with a button that was coded to report whether the user pressed OK or CANCEL.

**Step 1)** In Selenium IDE, set the Base URL to http://jsbin.com. The full URL is http://jsbin.com/enifaf.

**Step 2)** Create the script as shown below. This time we will press the OK button first.

[](https://www.guru99.com/images/image017.png)

**Step 3)** Execute the script and notice that you do not see the actual confirmation, yet the webpage still reports which button Selenium IDE pressed.

[](https://www.guru99.com/images/image018.png)

**Step 4)** Replace the chooseOkOnNextConfirmation command with chooseCancelOnNextConfirmation and execute the script again. The page now reports the opposite choice.

[](https://www.guru99.com/images/image019.png)

## Multiple Windows

If you click a link that launches a separate window, you must first instruct Selenium IDE to select that window before you can access the elements inside it. In the legacy IDE you use the window’s title as its locator.

**We use the selectWindow command to switch between windows.**

We will use the link http://jsbin.com/ocinaj/1, whose title is “First Window.” The “here” hyperlink on that page opens Facebook in a new window, after which we instruct Selenium IDE to do the following:

* Transfer control from the parent window to the newly launched Facebook window using the selectWindow command with the window title as the locator.
* Verify the title of the new window.
* Select the original window again using the selectWindow command with “null” as its target.
* Verify the title of the currently selected window.

The plan above translates into the four-step sequence shown here.

[](https://www.guru99.com/images/image020.png)

**Step 1)** Set the Base URL to http://jsbin.com.

**Step 2)** Create the script as shown below.

[](https://www.guru99.com/images/image021.png)

We need the pause command to wait for the newly launched window to load before we can read its title.

**Step 3)** Execute the script. Notice that the [test case](https://www.guru99.com/test-case.html) passed, meaning we were able to switch between windows and verify their titles successfully.

[](https://www.guru99.com/images/image022.png)

Always remember that setting the selectWindow target to “null” automatically selects the parent window — in this case the window where the element “link=here” is found.

**Note:** Facebook has changed its page title since this tutorial was created. Modify the expected title in the script accordingly.

## Modern Selenium IDE Equivalents of These Commands

The Firefox-plugin IDE was retired when Firefox moved to the WebExtensions architecture, and the current Chrome, Firefox and Edge extension renamed most Selenese commands to a spaced form. The behaviour is unchanged, so the table below is all you need to read the scripts above against a current install.

| Legacy command in this tutorial | Current Selenium IDE command                      |
| ------------------------------- | ------------------------------------------------- |
| store                           | store                                             |
| echo                            | echo                                              |
| storeText                       | store text                                        |
| storeElementPresent             | store element present (or assert element present) |
| assertAlert / verifyAlert       | assert alert / verify alert                       |
| chooseOkOnNextConfirmation      | choose ok on next confirmation                    |
| chooseCancelOnNextConfirmation  | choose cancel on next confirmation                |
| selectWindow (title as target)  | select window with handle=${handle}               |

Two differences are worth calling out. Prompts, which the legacy article does not cover, now have their own commands: **answer on next prompt** plans the reply before the dialog appears, and **webdriver answer on visible prompt** types into a prompt that is already open. And window switching no longer relies on the page title. Run **store window handle** to capture a handle first, then pass **handle=${yourHandle}** to select window. That change removes the failure mode described in the note above, where a site simply renames its page and the script stops finding the window. The official [Selenium IDE project site](https://www.selenium.dev/selenium-ide/) lists the full current command set.

## FAQs

🔡 Are Selenium IDE variable names case-sensitive?

Yes. ${myVariable} and ${myvariable} refer to two different variables, and referencing one that was never stored resolves to an empty string rather than raising an error. Keep a single naming convention across a suite to avoid silent blanks.

🔗 Can a stored variable be used inside a URL or a locator?

Yes. The ${ } syntax is expanded in any Target or Value field, so it works inside an open command, an XPath or a CSS selector. That is how a recorded script is turned into one driven by data captured earlier in the run.

🧮 How do I perform arithmetic on a stored value?

Selenese has no maths operators. Use the execute script command with a small JavaScript expression that reads the variable and returns the result, then store that return value. Remember every stored value arrives as a string, so convert it first.

💾 Do variables survive between test cases in a suite?

Treat them as local to a single test. Relying on a value set by an earlier test makes the suite order-dependent and hard to debug, so store what a test needs inside that test, or read it from a data file at the start.

⌨️ How do I answer a prompt that asks for typed input?

A prompt needs text, not just a button choice. Run answer on next prompt with the reply in the Value field before the command that opens it, or use webdriver answer on visible prompt when the dialog is already on screen.

🤖 How does AI help build Selenium IDE test steps?

Machine learning tools can propose a command sequence from a plain-language description of a scenario and suggest sturdier locators than a recorder produces. AI-assisted locator repair also helps, since a renamed element is the usual reason a stored value comes back empty.

🚀 Can GitHub Copilot help after exporting an IDE script?

Yes. Export the test to Java or Python, then let Copilot refactor the flat command list into page objects and reusable waits. Check the alert handling by hand, because generated code often assumes a visible dialog that the IDE already dismissed.

🪟 What happens when two open windows share the same title?

Title-based selection becomes ambiguous and the wrong window may be chosen. This is exactly why the current IDE prefers handles: capture one with store window handle right after the window opens, then switch with handle=${yourHandle}.

#### Summarize this post with:

ChatGPT Perplexity Grok Google AI 

**Stay Updated on AI** **Get Weekly AI Skills, Trends, Actionable Advice.** 

##### Sign up for the newsletter

Subscribe for Free 

You have successfully subscribed.  
Please check your inbox. 

![AI-Newsletter]() Chosen by over **350,000+** professionals 

[Scroll to top ](#wrapper)Scroll to top 

× 

Toggle Menu Close 

Search for: 

Search

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.guru99.com/#organization","name":"Guru99","sameAs":["https://www.facebook.com/Guru99Official","https://twitter.com/guru99com"],"logo":{"@type":"ImageObject","@id":"https://www.guru99.com/#logo","url":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","contentUrl":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","caption":"Guru99","inLanguage":"en-US"}},{"@type":"WebSite","@id":"https://www.guru99.com/#website","url":"https://www.guru99.com","name":"Guru99","publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https://www.guru99.com/images/store-variables-echo-alert-popup-in-selenium-ide.png","url":"https://www.guru99.com/images/store-variables-echo-alert-popup-in-selenium-ide.png","width":"700","height":"250","caption":"Store Variables, Echo, Alert, PopUp handling in Selenium IDE","inLanguage":"en-US"},{"@type":"BreadcrumbList","@id":"https://www.guru99.com/store-variables-handling-selenium-ide.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":"1","item":{"@id":"https://www.guru99.com","name":"Home"}},{"@type":"ListItem","position":"2","item":{"@id":"https://www.guru99.com/selenium","name":"Selenium"}},{"@type":"ListItem","position":"3","item":{"@id":"https://www.guru99.com/store-variables-handling-selenium-ide.html","name":"Store Variables, Echo, Alert, PopUp handling in Selenium IDE"}}]},{"@type":"WebPage","@id":"https://www.guru99.com/store-variables-handling-selenium-ide.html#webpage","url":"https://www.guru99.com/store-variables-handling-selenium-ide.html","name":"Store Variables, Echo, Alert, PopUp handling in Selenium IDE","dateModified":"2026-07-30T11:42:57+05:30","isPartOf":{"@id":"https://www.guru99.com/#website"},"primaryImageOfPage":{"@id":"https://www.guru99.com/images/store-variables-echo-alert-popup-in-selenium-ide.png"},"inLanguage":"en-US","breadcrumb":{"@id":"https://www.guru99.com/store-variables-handling-selenium-ide.html#breadcrumb"}},{"@type":"Person","@id":"https://www.guru99.com/author/admin","name":"Krishna Rungta","url":"https://www.guru99.com/author/admin","image":{"@type":"ImageObject","@id":"https://www.guru99.com/images/krishna-rungta-v2-120x120.png","url":"https://www.guru99.com/images/krishna-rungta-v2-120x120.png","caption":"Krishna Rungta","inLanguage":"en-US"},"worksFor":{"@id":"https://www.guru99.com/#organization"}},{"articleSection":"Selenium","headline":"Store Variables, Echo, Alert, PopUp handling in Selenium IDE","description":"In this tutorial, we will learn, Store commands, Echo commands, Alerts and Popup handling, Confirmations and about Multiple Windows.","keywords":"selenium","speakable":{"@type":"SpeakableSpecification","cssSelector":[".entry-title",".summary"]},"@type":"Article","author":{"@id":"https://www.guru99.com/author/admin","name":"Krishna Rungta"},"dateModified":"2026-07-30T11:42:57+05:30","image":{"@id":"https://www.guru99.com/images/store-variables-echo-alert-popup-in-selenium-ide.png"},"copyrightYear":"2026","name":"Store Variables, Echo, Alert, PopUp handling in Selenium IDE","subjectOf":[{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"Are Selenium IDE variable names case-sensitive?","acceptedAnswer":{"@type":"Answer","text":"Yes. ${myVariable} and ${myvariable} refer to two different variables, and referencing one that was never stored resolves to an empty string rather than raising an error. Keep a single naming convention across a suite to avoid silent blanks."}},{"@type":"Question","name":"Can a stored variable be used inside a URL or a locator?","acceptedAnswer":{"@type":"Answer","text":"Yes. The ${ } syntax is expanded in any Target or Value field, so it works inside an open command, an XPath or a CSS selector. That is how a recorded script is turned into one driven by data captured earlier in the run."}},{"@type":"Question","name":"How do I perform arithmetic on a stored value?","acceptedAnswer":{"@type":"Answer","text":"Selenese has no maths operators. Use the execute script command with a small JavaScript expression that reads the variable and returns the result, then store that return value. Remember every stored value arrives as a string, so convert it first."}},{"@type":"Question","name":"Do variables survive between test cases in a suite?","acceptedAnswer":{"@type":"Answer","text":"Treat them as local to a single test. Relying on a value set by an earlier test makes the suite order-dependent and hard to debug, so store what a test needs inside that test, or read it from a data file at the start."}},{"@type":"Question","name":"How do I answer a prompt that asks for typed input?","acceptedAnswer":{"@type":"Answer","text":"A prompt needs text, not just a button choice. Run answer on next prompt with the reply in the Value field before the command that opens it, or use webdriver answer on visible prompt when the dialog is already on screen."}},{"@type":"Question","name":"How does AI help build Selenium IDE test steps?","acceptedAnswer":{"@type":"Answer","text":"Machine learning tools can propose a command sequence from a plain-language description of a scenario and suggest sturdier locators than a recorder produces. AI-assisted locator repair also helps, since a renamed element is the usual reason a stored value comes back empty."}},{"@type":"Question","name":"Can GitHub Copilot help after exporting an IDE script?","acceptedAnswer":{"@type":"Answer","text":"Yes. Export the test to Java or Python, then let Copilot refactor the flat command list into page objects and reusable waits. Check the alert handling by hand, because generated code often assumes a visible dialog that the IDE already dismissed."}},{"@type":"Question","name":"What happens when two open windows share the same title?","acceptedAnswer":{"@type":"Answer","text":"Title-based selection becomes ambiguous and the wrong window may be chosen. This is exactly why the current IDE prefers handles: capture one with store window handle right after the window opens, then switch with handle=${yourHandle}."}}]}],"@id":"https://www.guru99.com/store-variables-handling-selenium-ide.html#schema-1155532","isPartOf":{"@id":"https://www.guru99.com/store-variables-handling-selenium-ide.html#webpage"},"publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US","mainEntityOfPage":{"@id":"https://www.guru99.com/store-variables-handling-selenium-ide.html#webpage"}}]}
```
