Page 1 of 2 • 1, 2
- umashankarActive particpant
- Posts : 24
Join date : 2011-11-14
Not able to click on "OK" in Alert box
Thu Nov 17, 2011 1:25 pm
Hi All,
I am new to selenium and now am trying Selenium IDE and stuck at " HOW TO CLICK ON "OK" IN ALERT BOX",
1. This step not recorded using selenium IDE.
2. I have tried using assertAlert, verifyAlert, ...etc but no luck.
3. In my application most of the scenarios has this Alert and need this to move forward.
4. Is there any way to overcome this issue?
Please anyone help me to fix this issue. Thanks a lot..
Thanks,
umashankar.v
I am new to selenium and now am trying Selenium IDE and stuck at " HOW TO CLICK ON "OK" IN ALERT BOX",
1. This step not recorded using selenium IDE.
2. I have tried using assertAlert, verifyAlert, ...etc but no luck.
3. In my application most of the scenarios has this Alert and need this to move forward.
4. Is there any way to overcome this issue?
Please anyone help me to fix this issue. Thanks a lot..
Thanks,
umashankar.v
- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
Re: Not able to click on "OK" in Alert box
Thu Nov 17, 2011 6:00 pm
Look at answerOnNextPrompt().
- umashankarActive particpant
- Posts : 24
Join date : 2011-11-14
Re: Not able to click on "OK" in Alert box
Thu Nov 17, 2011 8:50 pm
Hi faramka,
Thanks for your info, I have tried using answerOnNextPrompt() and get result as,
[info] Executing: |click | //input[@id='ctl00_ContentPlaceHolder1_btnAdd'] | |
[info] Executing: |answerOnNextPrompt | You must enter a value in the following fields:- Upload jpg or pdf file only | |
[error] There was an unexpected Alert! [You must enter a value in the following fields: - Upload jpg or pdf file only]
Here while am running , i am not able to see that popup and i am getting the message as above.
Can you please tell me what it exactly doing?
Thanks
Thanks for your info, I have tried using answerOnNextPrompt() and get result as,
Here while am running , i am not able to see that popup and i am getting the message as above.
Can you please tell me what it exactly doing?
Thanks
- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
Re: Not able to click on "OK" in Alert box
Thu Nov 17, 2011 9:02 pm
Did you use this method without any parameters?
answerOnNextPrompt(answer)
answer - the answer to give in response to the prompt pop-up
Found at seleniumwiki
answerOnNextPrompt(answer)
answer - the answer to give in response to the prompt pop-up
Found at seleniumwiki
- umashankarActive particpant
- Posts : 24
Join date : 2011-11-14
Re: Not able to click on "OK" in Alert box
Fri Nov 18, 2011 12:39 pm
Hi Faramka,
Thanks for your valuable info, Actually I want click "OK" when Alert pops up and want to perform other operations in the same page. Using answerOnNextPrompt its not clicking "OK" on the Alert and in the log its telling, "There was an unexpected Alert" as its not able to identify the Alert and Click on "OK", I am not able to perform any actions after that.
Help me to overcome this issue. Thank you..
Thanks for your valuable info, Actually I want click "OK" when Alert pops up and want to perform other operations in the same page. Using answerOnNextPrompt its not clicking "OK" on the Alert and in the log its telling, "There was an unexpected Alert" as its not able to identify the Alert and Click on "OK", I am not able to perform any actions after that.
Help me to overcome this issue. Thank you..
- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
Re: Not able to click on "OK" in Alert box
Fri Nov 18, 2011 2:21 pm
Try implement short delays between the actions by using one of the waitFor... methods and be sure the page is completely loaded.
- umashankarActive particpant
- Posts : 24
Join date : 2011-11-14
Re: Not able to click on "OK" in Alert box
Fri Nov 18, 2011 2:51 pm
Hi Faramka,
I tried as you said but no luck, please check my code
answerOnNextPrompt | |
click | id=ct100_ContentPlaceHolder1_btnAdd |
waitforAlertPresent
type | id=ct100_ContentPlaceHolder1_txtCost |123
I got the log as,
[info] Executing: |click | id=ctl00_ContentPlaceHolder1_btnAdd | |
[info] Executing: |waitForAlertPresent | | |
[info] Executing: |type | id=ctl00_ContentPlaceHolder1_txtCost | 123 |
[error] There was an unexpected Alert! [You must enter a value in the following fields: - Item ID - Description - Minimum Quantity - Maximum Qty - Category - Sub Category - Type - UOM ]
Here after click operation performed this Alert comes and i want to click on "OK" using selenium.
Am trying by various way but no luck Faramka.
Is there anyway to fix this issue??
Help me guys....
I tried as you said but no luck, please check my code
answerOnNextPrompt | |
click | id=ct100_ContentPlaceHolder1_btnAdd |
waitforAlertPresent
type | id=ct100_ContentPlaceHolder1_txtCost |123
I got the log as,
Here after click operation performed this Alert comes and i want to click on "OK" using selenium.
Am trying by various way but no luck Faramka.
Is there anyway to fix this issue??
Help me guys....
- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
Re: Not able to click on "OK" in Alert box
Fri Nov 18, 2011 3:42 pm
As I told you earlier, the answerOnNextPrompt() takes a parameter. So you should do:
answerOnNextPrompt|OK|
or something like that.
Let me know if you solved the problem.
answerOnNextPrompt|OK|
or something like that.
Let me know if you solved the problem.
- umashankarActive particpant
- Posts : 24
Join date : 2011-11-14
Re: Not able to click on "OK" in Alert box
Fri Nov 18, 2011 3:53 pm
Hi Faramka,
Yes, i tried the way you said but no luck, now also getting the same error,
[info] Executing: |answerOnNextPrompt | OK | |
[info] Executing: |click | id=ctl00_ContentPlaceHolder1_btnAdd | |
[info] Executing: |type | id=ctl00_ContentPlaceHolder1_txtCost | 123 |
[error] There was an unexpected Alert! [You must enter a value in the following fields: - Item ID - Description - Minimum Quantity - Maximum Qty - Category - Sub Category - Type - UOM ]
Am not sure where i went wrong?
Is there anyother way faramka???????
Yes, i tried the way you said but no luck, now also getting the same error,
Am not sure where i went wrong?
Is there anyother way faramka???????
- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
Re: Not able to click on "OK" in Alert box
Fri Nov 18, 2011 4:13 pm
Maybe documentation could help....
http://seleniumhq.org/docs/02_selenium_ide.html#alerts-popups-and-multiple-windows
http://seleniumhq.org/docs/02_selenium_ide.html#alerts-popups-and-multiple-windows
- umashankarActive particpant
- Posts : 24
Join date : 2011-11-14
Re: Not able to click on "OK" in Alert box
Fri Nov 18, 2011 4:28 pm
Hi Faramka,
Thank you so much for sharing this valuable info, I get to know that this feature is not available in Selenium, Check this
getConfirmation()
Returns:
the message of the most recent JavaScript confirmation dialogRetrieves the message of a JavaScript confirmation dialog generated during the previous action.
By default, the confirm function will return true, having the same effect as manually clicking OK. This can be changed by prior execution of the chooseCancelOnNextConfirmation command.
If an confirmation is generated but you do not consume it with getConfirmation, the next Selenium action will fail.
NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible dialog.
NOTE: Selenium does NOT support JavaScript confirmations that are generated in a page's onload() event handler. In this case a visible dialog WILL be generated and Selenium will hang until you manually click OK.
So unless we click manually it wont move to next step, Is it so?????
Please share your idea..
Thanks..
Thank you so much for sharing this valuable info, I get to know that this feature is not available in Selenium, Check this
getConfirmation()
Returns:
the message of the most recent JavaScript confirmation dialogRetrieves the message of a JavaScript confirmation dialog generated during the previous action.
By default, the confirm function will return true, having the same effect as manually clicking OK. This can be changed by prior execution of the chooseCancelOnNextConfirmation command.
If an confirmation is generated but you do not consume it with getConfirmation, the next Selenium action will fail.
NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible dialog.
NOTE: Selenium does NOT support JavaScript confirmations that are generated in a page's onload() event handler. In this case a visible dialog WILL be generated and Selenium will hang until you manually click OK.
So unless we click manually it wont move to next step, Is it so?????
Please share your idea..
Thanks..
- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
Re: Not able to click on "OK" in Alert box
Fri Nov 18, 2011 6:25 pm
Is the alert similar to this one http://www.w3schools.com/js/tryit.asp?filename=tryjs_alert ?
- umashankarActive particpant
- Posts : 24
Join date : 2011-11-14
Re: Not able to click on "OK" in Alert box
Fri Nov 18, 2011 6:47 pm
Hi faramka,
Here i have attached the screen shot of it.. Please have a look at it and help me.
Thanks.
Here i have attached the screen shot of it.. Please have a look at it and help me.
Thanks.
- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
Re: Not able to click on "OK" in Alert box
Fri Nov 18, 2011 9:21 pm
OK, I've got your screenshot. Could you please right click on "OK" element of the alert and choose "inspect element" from the contextual menu, then show HTML from Firebug?
- umashankarActive particpant
- Posts : 24
Join date : 2011-11-14
Re: Not able to click on "OK" in Alert box
Mon Nov 21, 2011 12:00 pm
Hi Faramka,
I tried as you said , but after alert pop-ups "RIGHT CLICK" is not working and i am not able to inspect the element. Only when i click on "OK" it is working, So its possible to click on "OK" faramka?
I tried as you said , but after alert pop-ups "RIGHT CLICK" is not working and i am not able to inspect the element. Only when i click on "OK" it is working, So its possible to click on "OK" faramka?
- umashankarActive particpant
- Posts : 24
Join date : 2011-11-14
Re: Not able to click on "OK" in Alert box
Mon Nov 21, 2011 2:19 pm
Hi Faramka,
I tried with
storeAlert | variablename |
Its working fine, Thanks a lot faramka, but for some Alert when it pop-ups the page is in "Loading State" and still we clicking on "OK" its in loading state and in this case, i am not able to click on "OK". Also this Alert is visble when i run with "Selenium IDE". Faramka help me in this issue.
I tried with
storeAlert | variablename |
Its working fine, Thanks a lot faramka, but for some Alert when it pop-ups the page is in "Loading State" and still we clicking on "OK" its in loading state and in this case, i am not able to click on "OK". Also this Alert is visble when i run with "Selenium IDE". Faramka help me in this issue.
- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
Re: Not able to click on "OK" in Alert box
Mon Nov 21, 2011 5:52 pm
Did you try wait until the page will load completely using waitForPageToLoad()?umashankar wrote:(...) but for some Alert when it pop-ups the page is in "Loading State" (...)
- umashankarActive particpant
- Posts : 24
Join date : 2011-11-14
Re: Not able to click on "OK" in Alert box
Mon Nov 21, 2011 6:23 pm
Hi Faramka,
I tried the way you said before but no luck and in the reference it given as,
storeAlert(variableName)
Generated from getAlert()
Returns:
The message of the most recent JavaScript alertRetrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts.
Getting an alert has the same effect as manually clicking OK. If an alert is generated but you do not consume it with getAlert, the next Selenium action will fail.
Under Selenium, JavaScript alerts will NOT pop up a visible alert dialog.
Selenium does NOT support JavaScript alerts that are generated in a page's onload() event handler. In this case a visible dialog WILL be generated and Selenium will hang until someone manually clicks OK.
This alert is also "JavaScript alerts that are generated in a page's onload() event handler"
How to handle this faramka?
Thanks
I tried the way you said before but no luck and in the reference it given as,
storeAlert(variableName)
Generated from getAlert()
Returns:
The message of the most recent JavaScript alertRetrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts.
Getting an alert has the same effect as manually clicking OK. If an alert is generated but you do not consume it with getAlert, the next Selenium action will fail.
Under Selenium, JavaScript alerts will NOT pop up a visible alert dialog.
Selenium does NOT support JavaScript alerts that are generated in a page's onload() event handler. In this case a visible dialog WILL be generated and Selenium will hang until someone manually clicks OK.
This alert is also "JavaScript alerts that are generated in a page's onload() event handler"
How to handle this faramka?
Thanks
- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
Re: Not able to click on "OK" in Alert box
Mon Nov 21, 2011 6:34 pm
Maybe this art would help:
http://testerinyou.blogspot.com/2011/05/handling-alerts.html
I'm sorry, but I have no more ideas. Maybe someone else would help you.
http://testerinyou.blogspot.com/2011/05/handling-alerts.html
I'm sorry, but I have no more ideas. Maybe someone else would help you.
- umashankarActive particpant
- Posts : 24
Join date : 2011-11-14
Re: Not able to click on "OK" in Alert box
Mon Nov 21, 2011 7:02 pm
Hi Faramka,
It was the same msg i posted above. Thank you so much for your great help..
Many Thanks
It was the same msg i posted above. Thank you so much for your great help..
Many Thanks
- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
Re: Not able to click on "OK" in Alert box
Mon Nov 21, 2011 7:22 pm
So you solved the problem?
I'm glad to managed to do it
I'm glad to managed to do it
- umashankarActive particpant
- Posts : 24
Join date : 2011-11-14
Re: Not able to click on "OK" in Alert box
Mon Nov 21, 2011 8:04 pm
Hi Faramka,
No, I didn't solved it. That says its not possible with Selenium IDE to click "OK" on Onload javascript Alert.
So i thought it is not possible with Selenium IDE.
If i was wrong please correct me.
Thanks
No, I didn't solved it. That says its not possible with Selenium IDE to click "OK" on Onload javascript Alert.
So i thought it is not possible with Selenium IDE.
If i was wrong please correct me.
Thanks
- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
Re: Not able to click on "OK" in Alert box
Mon Nov 21, 2011 8:29 pm
In the first part of this article there is in fact the same error as you get, but further there is a solution of handling alerts. It is a
script (java), but I think you can use some methods in Selenium IDE.
Examine the code and try apply it in your work.
Good luck
script (java), but I think you can use some methods in Selenium IDE.
Examine the code and try apply it in your work.
Good luck
- umashankarActive particpant
- Posts : 24
Join date : 2011-11-14
Re: Not able to click on "OK" in Alert box
Mon Nov 21, 2011 8:45 pm
Hi Faramka,
You are correct but after i change the format to "Junit" the code is not get saved in "Selenium IDE". Hope this will work in "Selenium RC". But i know only Selenium IDE, Thought of work on "Selenium IDE" and after get confidence i will move on to "Selenium RC" and later version.
Faramka, i have one doubt, is it possible in "Selenium IDE" to run the script after change the format to our desired language?
If so, please help me in this..
Thanks a lot..
You are correct but after i change the format to "Junit" the code is not get saved in "Selenium IDE". Hope this will work in "Selenium RC". But i know only Selenium IDE, Thought of work on "Selenium IDE" and after get confidence i will move on to "Selenium RC" and later version.
Faramka, i have one doubt, is it possible in "Selenium IDE" to run the script after change the format to our desired language?
If so, please help me in this..
Thanks a lot..
- faramkaProfessional
- Posts : 143
Join date : 2011-09-15
Location : Poland
Re: Not able to click on "OK" in Alert box
Mon Nov 21, 2011 9:12 pm
umashankar wrote:Faramka, i have one doubt, is it possible in "Selenium IDE" to run the script after change the format to our desired language?
Unfortunately I don't know the answer to this question.
umashankar wrote:Thought of work on "Selenium IDE" and after get confidence i will move on to "Selenium RC" and later version.
In my opinion Selenium RC is more friendly and it has much more possibilities of simulation. Furthermore, writing scripts in it is not more difficult than execution of actions in IDE.
Page 1 of 2 • 1, 2
- IDE not recording click on table row (with jquery click handler attached)
- Select the “back” button of the Firefox browser to right click and Select the Option from the right click Menu in Selenium Web Driver - Java
- how to handle an Alert message
- Error with Alert
- How to capture the alert message in Selenium IDE
Permissions in this forum:
You cannot reply to topics in this forum