Before learning "storePrompt" and "verifyPrompt" commands, you should be aware about the difference between alert, confirmation and prompt. You will see 3 buttons on this link. 1. Show me Confirmation, 2. Show Me Alert and 3. Show Me Prompt. Press each one by one and see difference between them. Prompt
message is combination of confirmation message and input box. To handle this kind of message, you need to use "storePrompt" and "verifyPrompt" commands.
"storePrompt" Command
"storePrompt" command is useful to store prompt message string in to the specified variable.
"verifyPrompt" Command
"verifyPrompt" command verifies the generated prompt message string with targeted string. It will pass if both strings will match else it will return error like '[error] Actual value 'Your Name Please' did not match 'Your Name Please1''.
Run bellow given example in selenium IDE and then use both the commands in your software application test case if there is any prompt message.
New Test | ||
Command | Target | Value |
open | http://only-testing-blog.blogspot.com/2013/11/new-test.html | |
click | //button[@onclick='myFunctionf()'] | |
storePrompt | i | |
echo | ${i} | |
click | //button[@onclick='myFunctionf()'] | |
verifyPrompt | Your Name Please |
Visit more store commands and verification commands example pages.
Hi,
ReplyDeleteI am using Selenium for testing and I use "verifyText" command. I need some help.
"verifyText" has text 10. now if this text changes from 10 to 11, error occurs. I need a step where difference of 1 (up or down) does not cause an error.
Please help me.
Post your email id here. It will be not published. I will send you a practical example on it.
DeleteCan you make the answer of this problem public please? Thank you
DeleteYou can do it using wild card * at beginning or between or at the end of string as per your requirement.
DeleteExample :
Actual Message String : "This is Your Message".
You can write it as "* is Your Message" Or "This is * Message" Or "This is Your *". All three will works as a wild card.
I am using .JSON file format
ReplyDelete