Unable to handle confrimation box with selenium RC - selenium

i am trying to press the ok button from a confirmation box like this (i added Thread.spleep so i checked the button is pressed and the confirmation box is shown)
selenium.chooseOkOnNextConfirmation();
selenium.click("xpath=//a[contains(#href,'123')]");
assertTrue(selenium.getConfirmation().equalsIgnoreCase("123"));
but i get this
com.thoughtworks.selenium.SeleniumException: ERROR: There were no confirmations
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:262)
at com.thoughtworks.selenium.DefaultSelenium.getConfirmation(DefaultSelenium.java:429)
Thx for your help.

I got the same error with the code
selenium.chooseCancelOnNextConfirmation();//点击cancel按钮
selenium.click("link=Delete");
selenium.getConfirmation();
Finally I find the reason is that the developer used the jconfirm function of jquery instead of window.confirm, and the jconfirm function is override with div.
Finally I used assertTrue(selenium.isElementPresent("id=popup_container")).

from this information it is hard to say exactly. but i will give you some info which will help you
java script generates 3 types of pop-up windows
1) Alerts
2)Confirmations
3)Prompts
your case, i guess
1) may be the statement selenium.click() you used, is not triggering the confirmation box
OR
2) if it is triggering, then it may not be the Confirmation box.it could be any one of the other 2 boxes
so, you must make sure manually what type of pop-up window it is and call the statements accordingly.
ex : Confirmation window : conatins OK and Cancel buttons
Alert window : contains only OK button
Prompt window : contains Textbox and OK and Cancel buttons
so check and use that commands respectively
if it is not the above case please the HTML code also

Related

How to handle modal/ pop-up using automation

Tried to handle the pop-up many ways, need clarity do we need to change the body. because when the pop-up is displayed the new class is adding it is as below.
https://i.stack.imgur.com/jQC2B.png
The actual Pop-up class is as below. there is no close button for this pop-up.
https://i.stack.imgur.com/e1ZWc.png
-By manual user can close the pop-up when user click any where in the page. When i tried click any where using automation it is displaying as element not found
Here is the code i user to handle the pop-up i am so confused how to handle the pop-up
https://i.stack.imgur.com/ibf0j.png
Thanks for help in advance
please try to check the javascript from where this pop-up is executing and try to disable display property by setting it to none
Try to remove this div class name "_355Q0" from DOM. by using this javascript query.
var myobj = document.querySelector("._355Q0")
myobj.remove();

Check some field before opening confirmation box in ODOO

I want to check that if some fields in the form view has been checked or not. If they have been checked then show a confirmation message and if not then a error message saying that those fields must be checked. For this functionality I have created a button which calls a specific function in the model. The button has also attribute confirm which enables the confirmation pop up box. But all the time it first opens the confirmation message and then the checking for the fields. I want to have the other way around how to achieve this. Please help.

Cannot click Submit button on Selenium IDE

I am having trouble getting Selenium IDE to click the Submit button on one of my webforms after having selenium open and fill out the form. I am using the clickAndWait command and identifying the button by its ID:
<td>clickAndWait</td>
<td>id=ctl00_ContentPlaceHolder1_OSVFHResults_btSave</td>
<td></td>
Interestingly, if I write a script that simply opens the form and clicks the submit button without filling it out, I am not having any problems. My problem is coming specifically after I've asked Selenium to fill out the form. Additionally, if I try to manually click the submit button, it doesn't work if the Selenium script to fill out the form was run before my manual input. If I manually open and fill out the form, I have no problems clicking submit, and Selenium works for all of the other form's submit buttons on the site. Anyone have any ideas?
Instead of filling form with type command you can try typeKeys one. It simulates keystroke events on the specified element, as though you typed the value key-by-key and probably enable your submit button.
It sounds like some javascript event unrelated to click() (such as mouseover or onkeydown) is attached to one or more of the form fields and is responsible for enabling the submit button.
You'd have to look at which exact events are being fired, either by looking at the source with something like firebug, or by using a javascript debugger. Then modify your Selenium script to make sure the same events get triggered.
After type the values in the form just try "ClickAtandWait" instead of "clickandWait"..i also face the problem once and it gave hands once..
selenium.clickAtandWait("locator", "position");
if you know the exact "position" just put it, otherwise leave it as an empty string.

Is it possible to have an extension library dialog box within a repeat control?

I'm running with an 8.5.3 UP1 server and I have a need to have many dialog boxes (for confirmation purposes) for a whole bunch of "action buttons" on an xpage. The code for these dialog boxes is almost exactly the same with the exception of the confirmation message being different and the client-side JS function they are calling if the Yes button is selected.
Since I really hate repeating code over and over, I was wondering if it is at all possible to put a xe:dialog control within a repeat control and specify the message and function call from an array of values? I know I can't compute the ID of the dialog control and without that I'm not sure how I would reference the dialog to open and close it.
Any ideas? Thanks
Yes, this is possible.
Make sure that you specify that the dialog box's property for keepComponents is set to False. You don;t have to do anything special for opening or closing the dialog box, just use whatever ID you give the dialog box in you client-side action to open the dialog box in the repeat such as XSP.openDialog('#{id:myDialog}')
The XPages renderer will automatically calculate the correct ID names for you.

How to capture response from Cancel or Ok Button in two different Applications?

With my Application (vb.net) I am trying to scan Excel files some of which have ActiveX Components.
When running my Application, I am getting a pup-up window in Windows Vista Environment with Office-2007 having button OK and Cancel button to proceed.
But my problem is the scanning is not proceeding even after I keep on pressing the OK button. Now I want to continue with my application while pressing the Cancel button; i.e. just to skip the file. Is it possible to capture the response from the cancel button? (As this is a message box from another application, i.e. either from Vista or Office-2007, I'm not sure).
My main motive is to just ignore the message box to proceed....
Can anyone please help me out there....
Thank you....
The DisplayAlerts property of Microsoft.Interop.Excel.Application may help here.
If set to FALSE then Excel automatically chooses the default option on pop-up boxes.
Whether or not this applies to ActiveX controls I don't know but it may be worth trying.