Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» FlexMonkium Download Not available under Gorillalogic site
Thu Dec 08, 2016 5:40 pm by bhanu.praveen

» Selenium Script issue
Tue Dec 06, 2016 9:48 pm by njain213

» Difference between QTP, Selenium and Silk test
Tue Dec 06, 2016 7:58 pm by jessicacyrus1

» Where does selenium script pick browser from
Tue Dec 06, 2016 1:52 pm by janbaskt

» Safari throws an HTTP ERROR: 404
Tue Dec 06, 2016 1:51 pm by janbaskt

» Access Denied Error in Selenium RC
Tue Dec 06, 2016 1:51 pm by janbaskt

» Automating Flex application through selenium webdriver
Fri Dec 02, 2016 2:06 pm by abhinay.krs

» Starting with Selenium, what is Selenium?
Mon Nov 28, 2016 4:00 pm by Foma

» Getting started with Selenium
Mon Nov 28, 2016 3:23 pm by Rebbelx

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

How to capture the alert message in Selenium IDE

View previous topic View next topic Go down

How to capture the alert message in Selenium IDE

Post by saivik on Fri Nov 06, 2009 5:29 pm

I am stuck with capturing the alert message.

The Scenario is:

I have a form with input fields like CaseType(listbox), Lab(listbox), LastName(txtbox), FirstName(txtbox)... along with couple of other fields as well.

After entering all the fields, i click on Proceed button to submit the form.
When i click on Proceed button, an alert triggers with a message saying
"Case successfully submitted with Number: SLPS2009-123456". with an OK button.

So, now I have to verify that the alert has triggered and also i have to capture the entire message for using in the next pages.

I am really stuck with verifying and capturing the message through Selenium IDE.
I tried by using getAlert, assertAlert, assertAlertPresent.

But none of the things worked for me.

Can anyone pls put some light on my query....??? would really appreciate ur kind help.

-Saivik

saivik
Active particpant
Active particpant

Posts : 12
Join date : 2009-11-06

Back to top Go down

Re: How to capture the alert message in Selenium IDE

Post by Adviser on Sat Nov 07, 2009 4:06 pm

hi,

First of all welcome to this forum and thanks to post your query. Now lets move to your query.

1. to get the text of your alert box, use any of the following commands:

storeAlert | variableName |
storeConfirmation | variableName |

then use the value like : $variableName. This command will also click on OK button automatically.

2. to verify your alert use this:
storeAlertPresent(variableName)

3. There is one more command present, If you want to click on cancel button instead of OK button:
chooseCancelOnNextConfirmation()

To get information related to all functions avaliable in selenium, check out this link:
http://release.seleniumhq.org/selenium-core/0.8.0/reference.html


Best of luck.

Bye

Adviser
------------------------
------------------------

Posts : 379
Join date : 2009-07-30
Location : India

http://seleniumforum.forumotion.net

Back to top Go down

Re: How to capture the alert message in Selenium IDE

Post by saivik on Tue Nov 24, 2009 2:13 am

Hi,
I am trying like this,

[tr]< tr >
[td]< td >clickAndWait[/td]
[td]btnSubmit
[/td]
[td][/td]
[/tr]

[tr]
[td]storeAlert[/td]
[td][/td]
[td]var1[/td]
[/tr]

[tr]
[td]echo[/td]
[td]${var1}[/td]
[td][/td]
[/tr]

But no success. It shows the msg "There are no Alerts".
Even i tried with storeConfirmation also...but not getting.

Could u pls give me any sample working script, that captures the alert message?

I would be really thankful to you. Pls Kindly help me.

-Saivik

saivik
Active particpant
Active particpant

Posts : 12
Join date : 2009-11-06

Back to top Go down

Re: How to capture the alert message in Selenium IDE

Post by saivik on Tue Nov 24, 2009 1:36 pm

I recorded a script with alerts. the Selenium IDE save the command assertAlert with the message of that alert in target.
When I play this script this command fails and the button OK isn't pressed!

How to do this? Pls provide me some workaround.
How I can replace assertAlert with another command that works?

saivik
Active particpant
Active particpant

Posts : 12
Join date : 2009-11-06

Back to top Go down

Re: How to capture the alert message in Selenium IDE

Post by tpskarthick on Tue Feb 09, 2010 3:20 pm

I too have the same problem in capturing the alert messages..... using selenium could any one help........

tpskarthick

Posts : 6
Join date : 2010-02-09
Age : 30
Location : Chennai

Back to top Go down

Re: How to capture the alert message in Selenium IDE

Post by saivik on Tue Feb 09, 2010 3:35 pm

@tpskarthick,

I am looking for a work around on that issue. If i get to know, will update you.

-Saivik

saivik
Active particpant
Active particpant

Posts : 12
Join date : 2009-11-06

Back to top Go down

Re: How to capture the alert message in Selenium IDE

Post by tpskarthick on Tue Feb 09, 2010 4:55 pm

Hey ,,,,,,,,,

I got that fixed savik what adviser said is right use "storeAlertPresent" which identifies the alert messages,,,,,,,,,,,,,, try it dude

tpskarthick

Posts : 6
Join date : 2010-02-09
Age : 30
Location : Chennai

Back to top Go down

Re: How to capture the alert message in Selenium IDE

Post by tpskarthick on Tue Feb 09, 2010 5:11 pm



click
ctl00_ContentPlaceHolder1_btnSearch



storeAlertPresent




click
ctl00_ContentPlaceHolder1_btnSearch



storeAlertPresent




On clicking the search button an alert is displayed but it is not identified by selenium IDE kindly give me a solution. but al the alerts are accepted by using the storeassertvalue.

tpskarthick

Posts : 6
Join date : 2010-02-09
Age : 30
Location : Chennai

Back to top Go down

Re: How to capture the alert message in Selenium IDE

Post by sherin.jose on Fri Aug 19, 2011 4:21 pm

I am stuck with capturing the alert message.i am entering wrong password.and after login there is one alert like "Error Details : Invalid Password".i am using following code.
selenium.open("");
selenium.type("txtUserID", "sreejit");
selenium.type("txtPassword", "xyz");
selenium.waitForPageToLoad("30000")
selenium.click("btnLogin");

System.out.println("Alert1 " + selenium.getAlert());


but i getting error message like "There were no alerts".but im sure one alert is coming.Pls Kindly help me.

sherin.jose

Posts : 1
Join date : 2011-08-19

Back to top Go down

Re: How to capture the alert message in Selenium IDE

Post by samson on Mon Aug 29, 2011 1:09 pm

Hi Adviser, Can i have the sample script for the above solution which you gave.

i Accept the Answer of yours, as there will be a alert to the sys after a event, .....

waiting for your answer..

Thank you,
Samson. B

samson

Posts : 2
Join date : 2011-08-26

Back to top Go down

Re: How to capture the alert message in Selenium IDE

Post by ejaenv on Mon Aug 29, 2011 3:06 pm

Selenium's IDE browserbot captures alerts. AFAIK The reason why alerts are not captured is because the browserbot isn't set until the onLoad() event has occurred, so any alerts that occur before this event aren't captured and then the popup appears.


So the solution is to be sure that browserbot is set before the alert occurs. Googling I found 2 solutions:


option 1) set a timeout - the one which I use and it works

SO:


alert(..)



PUT:



function delayAlert() {
alert(...);
}


window.setTimeout("delayAlert()",1000)





option 2) put this capturing code before the alert:


var browserbot = parent.selenium.browserbot;
if (browserbot) {
browserbot.modifyWindowToRecordPopUpDialogs(window, browserbot);
}
alert("Alert message after those selenium workaround js snippet");







BTW the IDE commands I use are:

waitForAlertPresent |
storeAlert | alerta
echo | ${alerta}


OR
waitForAlertPresent |
assertAlert | "your alert message"


hope it helps


ejaenv

Posts : 5
Join date : 2011-08-26

Back to top Go down

Re: How to capture the alert message in Selenium IDE

Post by samson on Mon Aug 29, 2011 6:39 pm

Here i'm placing the sample[solution] for above questions...

For example when logout has a confirmation :
you may follow in this sequence :

selenium.chooseCancelOnNextConfirmation();
selenium.click("link=Logout");
String are = selenium.getConfirmation();
System.out.println(are);

I hope the above will be understood by the who r working on selenium rc.using junit3.

Thank you,

samson

Posts : 2
Join date : 2011-08-26

Back to top Go down

Re: How to capture the alert message in Selenium IDE

Post by Sponsored content Today at 1:00 pm


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum