Html file is at the bottom
selenium.open("Input_prompt_TestCase.html");
Verify there is no input dilog present while opening this file
assertTrue(!selenium.isPromptPresent());
When then Input prompts select NO first time by the command answerOnNextPrompt|no|
selenium.answerOnNextPrompt("no");
Now click to open the input dialog by clicking the link "Click here to open input dialog"
selenium.click("promptdialog");
Now verify prompt presents or not with the command verifyPromptPresent||assertTrue(selenium.isPromptPresent());
If it takes time to open the prompt then we can wait till 1 minute with the below code.
boolean Bool = false;
for (int second = 0; second < 60; second++) {
try {
if ((selenium.isPromptPresent())) {
Bool = true;
break;
}
}
catch (Exception ignore) {
}
pause(1000);
}
assertTrue(Bool);
Now after 1 minute verify the prompt presents or not with the command assertPromptPresent||
assertTrue(selenium.isPromptPresent());
If it verifies prompt is there then verify the text what is on prompt with the command verifyPrompt|Type 'automationtricks' and click OK|
verifyEquals("Type 'automationtricks' and click OK", selenium.getPrompt());
You can also verify the title of input prompt with the command verifyTitle|Test Prompt|
verifyEquals("*Testcases for input Prompt", selenium.getTitle());
Now you just enter automationtricks in input promt with this commandanswerOnNextPrompt|automationtricks|
selenium.answerOnNextPrompt("automationtricks");
and then click on ok with command clickAndWait|promptdialog|
selenium.click("promptdialog");
Now you can see the result based on your input
selenium.waitForPageToLoad("5000");
verifyTrue(selenium.isTextPresent("You have entered automationtricks!"));
For Selenium IDE user : How to handle prompt in selenium IDE
<tr>
<td>open</td>
<td>Input_prompt_TestCase.html</td>
<td></td>
</tr>
<tr>
<td>answerOnNextPrompt</td>
<td>automationtricks</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>promptdialog</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>You have entered automationtricks!</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>Input_prompt_TestCase.html</td>
<td></td>
</tr>
<tr>
<td>answerOnNextPrompt</td>
<td>niraj</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>promptdialog</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>You have not entered automationtricks!</td>
<td></td>
</tr>
For the above code find Html file below
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html">
<script type="text/javascript">
function opendialog() {
if (prompt("Type 'automationtricks' and click OK") == 'automationtricks') {
document.write("You have entered automationtricks!");
}
else{
document.write("You have not entered automationtricks!");
}
}
</script>
<title>Testcases for input Prompt</title>
</head>
<body>
<img style="width: 644px; height: 41px;" alt="banner" src="banner.gif"><br>
<a id="promptdialog" href="javascript:opendialog();">Click here to open input dialog</a>
</body>
</html>
Hi All I forgot to add HTML file to test above code.
ReplyDeleteYou can use below html to run above script.
HTML file
=================
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html">
<script type="text/javascript">
function opendialog() {
if (prompt("Type 'automationtricks' and click OK") == 'automationtricks') {
document.write("You have entered automationtricks!");
}
else{
document.write("You have not entered automationtricks!");
}
}
</script>
<title>Testcases for input Prompt</title>
</head>
<body>
<img style="width: 644px; height: 41px;" alt="banner" src="banner.gif"><br>
<a id="promptdialog" href="javascript:opendialog();">Click here to open input dialog</a>
</body>
</html>
Hi Mr. Nirja
ReplyDeleteAccidentally, I happened to see this post and it was useful for me to know the usage of the answerOnNextPrompt and nice explanation.
you can post some other examples on various Selenium commands which will be useful to beginners like me.
Thank you so much for this post.
ReplyDeleteHi Niraj
ReplyDeleteThanks, this is a great article you posted. It really helped me.Great work keep it up.
Malaysia & Singapore & brunei ultimate online blogshop for wholesale & quantity korean add-ons, accessories, earstuds, pendant, rings, hair,
ReplyDeletebracelet & bracelet add-ons. Offer 35 % wholesale rebate. Ship Worldwide
my web page :: Onesie
Malaysia & Singapore & brunei ultimate on-line blogshop for wholesale & quantity korean add-ons, accessories, earstuds, choker, rings, bangle, hair & bracelet
ReplyDeleteadd-ons. Deal 35 % wholesale price cut. Ship Worldwide
Here is my webpage Bondi tradesman
Malaysia & Singapore & brunei greatest on the internet blogshop
ReplyDeletefor wholesale & supply korean accessories, earrings, earstuds, necklace, rings, hair, bangle & trinket add-ons.
Promotion 35 % wholesale markdown. Ship Worldwide
My website: music marketing
Great post! We will be linking to this great content on our site.
ReplyDeleteKeep up the good writing.
Also visit my web blog diet tips
I loved as much as you'll receive carried out right here. The sketch is attractive, your authored material stylish. nonetheless, you command get bought an edginess over that you wish be delivering the following. unwell unquestionably come further formerly again since exactly the same nearly very often inside case you shield this increase.
ReplyDeleteFeel free to surf my blog - Trick Photography & Special Effects
I started learning SeleniumIDE commands. But i found this post has the nice explination of commands so far. Thank u sooooooo much. Very nice explination. Great job.
ReplyDeleteThis is really interesting, You are a very skilled blogger.
ReplyDeleteI've joined your rss feed and look forward to seeking more of your excellent post. Also, I've shared your website in my social networks!
Also see my web site > click the up coming site
Hi there, I log on to your blogs on a regular basis.
ReplyDeleteYour writing style is witty, keep doing what you're doing!
Also see my site > Go Here
Hello! This is my first visit to your blog! We are a team of volunteers and starting a new initiative in a community
ReplyDeletein the same niche. Your blog provided us useful information to work on.
You have done a wonderful job!
Feel free to visit my site :: diet doctor Miami
Amazing! This blog looks exactly like my old one!
ReplyDeleteIt's on a entirely different topic but it has pretty much the same page layout and design. Wonderful choice of colors!
Also see my web page: Miami diet physician
Amazing blog! Is your theme custom made or did you download
ReplyDeleteit from somewhere? A design like yours with a few simple tweeks would really make my blog shine.
Please let me know where you got your theme. With thanks
Feel free to surf my web page :: sailing charter ecommerce specialist
Hi! I realize this is sort of off-topic however I had to ask.
ReplyDeleteDoes running a well-established website like yours take a large amount of work?
I am completely new to running a blog however I do write in
my diary on a daily basis. I'd like to start a blog so I will be able to share my experience and views online. Please let me know if you have any suggestions or tips for new aspiring bloggers. Appreciate it!
Have a look at my web page ... wedding insurance comparisons
I feel that is one of the such a lot significant information for me.
ReplyDeleteAnd i'm satisfied studying your article. But should observation on few normal things, The site taste is great, the articles is really great : D. Good process, cheers
Here is my web-site Ways to Become a Millionaire
Wow! At last I got a blog from where I know how to in fact obtain helpful information regarding my study and knowledge.
ReplyDeleteFeel free to visit my page :: get healthy without cigarettes
Fantastic site. Lots of useful info here. I'm sending it to several buddies ans also sharing in delicious. And naturally, thank you in your effort!
ReplyDeleteMy page: cheap gw2 gold
You've made some good points there. I checked on the net for more info about the issue and found most individuals will go along with your views on this web site.
ReplyDeleteStop by my webpage: guild wars 2 gold
We are a group of volunteers and opening a new scheme in our community.
ReplyDeleteYour website provided us with useful information to work on.
You have done a formidable task and our whole neighborhood will likely be grateful to you.
Also visit my web site: canadian online casino
This cοst is the cоst effectivenеss.
ReplyDeleteΒеing an AϹN Mom myself іn Ѕpencer Hunn's downline I can say anything I want business on here. Think of Google Docs, and archived for retrieval at a later point in time development will have to pass on my two cents worth of ideas and new concepts.
Review my website - www.georgesvanier.com
As Pinterest's internal analytics capabilities evolve those center business decision makers will become known, and when they do, concentrating on their core skills.
ReplyDeleteHere is my homepage - how to improve seo
I think this is among the most important info for me. And i am glad reading your article.
ReplyDeleteBut wanna remark on few general things, The web site style is wonderful, the articles is really great : D.
Good job, cheers
Take a look at my web blog - http://www.wildpartygirls.org/
I know this if off topic but I'm looking into starting my own blog and was wondering what all is required to get set up? I'm assuming having a blog like yours would cost a
ReplyDeletepretty penny? I'm not very web savvy so I'm not 100% positive.
Any tips or advice would be greatly appreciated. Thank you
Also visit my web-site - teens outdoor orgy
Whats up this is kind of of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have to
ReplyDeletemanually code with HTML. I'm starting a blog soon but have no coding expertise so I wanted to get advice from someone with experience. Any help would be greatly appreciated!
Look at my page http://sexygirlchat.net
You can certainly see your expertise within the
ReplyDeletearticle you write. The sector hopes for more passionate writers like you who aren't afraid to say how they believe. At all times go after your heart.
my webpage cuteteenporn.net
Hello friends, its impressive piece of writing concerning cultureand fully explained, keep it up all the
ReplyDeletetime.
Check out my web page; onhiddencam.info
Hey there! I know this is sort of off-topic but I needed
ReplyDeleteto ask. Does running a well-established blog such as yours
require a large amount of work? I'm brand new to running a blog but I do write in my diary every day. I'd
like to start a blog so I will be able to share my experience and views
online. Please let me know if you have any kind of suggestions or
tips for new aspiring blog owners. Thankyou!
Also visit my site :: cuteteenporn.net
Excellent web site you have here.. It's difficult to find quality writing like yours nowadays. I honestly appreciate individuals like you! Take care!!
ReplyDeleteStop by my web blog: jnmassage.info
Hello, its fastidious piece of writing on the topic of media print, we all be familiar with media is a
ReplyDeleteimpressive source of data.
my webpage: get free porn movies
Hello, just wanted to mention, I loved this post.
ReplyDeleteIt was practical. Keep on posting!
my site; www.cfnmfever.net
Today, I went to the beachfront with my kids. I found a sea shell and gave it to my 4 year old
ReplyDeletedaughter and said "You can hear the ocean if you put this to your ear." She put
the shell to her ear and screamed. There was a hermit crab
inside and it pinched her ear. She never wants to go back!
LoL I know this is totally off topic but I had to tell someone!
Also visit my site http://hotgirlsexcam.com/videos/Natalie-webcam-VI-176
Hey there fantastic website! Does running a blog similar to this require a lot of work?
ReplyDeleteI have virtually no knowledge of coding but I was hoping to start my own blog soon.
Anyways, if you have any suggestions or techniques for new blog owners please
share. I know this is off subject but I just wanted to ask.
Kudos!
Check out my homepage ... tabitha stevens porn star ()
Thanks for providing good article on "How to handle the input prompt dialog in selenium". http://reditblog.blogspot.in/
ReplyDeleteNice blog....
ReplyDeleteSAP BW on Hana training
SAP CS training
SAP Fico training
SAP Grc training
GREATE ARTICLE....
ReplyDeleteSCCM training
SCOM training
SSAS training
SSIS training
SSRS training
Thanks for sharing....
ReplyDeleteSAP Grc training
SAP CS training
SAP mm training
SAP pm training
SAP PP training
SAP Qm training