selenium IDE “storeAlertPresent” and “storePromptPresent” Commands

After very long time, New post about selenium IDE. If you are new user of selenium then you can learn selenium IDE commands one by one from command list PART 1 and PART 2 where I have described mostly used commands with simple examples. Selenium IDE can also helps you to automate your web

application testing process If It has simple flow. Now today, Let me give you an example of 2 more selenium IDE commands.

You can read more store related commands of selenium IDE.
“storeAlertPresent” Command
“storeAlertPresent” command will check and verify If there Is any alert message on current page. If alert Is there then It will return and store true In variable else It will return false.
“storePromptPresent” Command
Same way, “storePromptPresent” will check for “Prompt” pop up  on page. If found then store true else store false In variable.
You can use both these commands when you wants to take some action based on alert or promp present or not present.

New Test
Command Target Value
open http://only-testing-blog.blogspot.com/2014/01/textbox.html
click css=div > input[type=”button”]
storeAlertPresent i
assertAlert Hi.. This is alert message!
echo ${i}
click //button[@onclick=’myFunctionf()’]
storePromptPresent j
echo ${j}
assertPrompt Your Name Please

Run above example In your selenium IDE and observe result. Both “storeAlertPresent” and “storePromptPresent” commands will store true In variables because previous action for both command Is generating popup of alert and prompt.

3 thoughts on “selenium IDE “storeAlertPresent” and “storePromptPresent” Commands

  1. After reading your post, one question is present:
    how does selenium to check if the popup is an alert or a prompt ?
    how to be sur that we are choosing the correct command ?

    WIth your exampler, the HMI does not show any difference between the both elements.

    thanks for any answer

  2. The question was: how to know if the message that appears is an alert or prompt?
    And what's the difference between these two and assertTextPresent?

Leave a Reply

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