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
CommandTargetValue
openhttp://only-testing-blog.blogspot.com/2014/01/textbox.html
clickcss=div > input[type="button"]
storeAlertPresenti
assertAlertHi.. This is alert message!
echo${i}
click//button[@onclick='myFunctionf()']
storePromptPresentj
echo${j}
assertPromptYour 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 comments:

  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

    ReplyDelete
    Replies
    1. Hello david,

      you can use verifyPrompt for prompt and verifyAlert for alert

      Delete
  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?

    ReplyDelete