Selenium RC popup window question - popup

My webpage submits information to a page and the response returns a popup window. Does anyone have an idea about how I can validate the information in the popup window?
Popup window doesn't have a WindowId and I'm not able to get hold of the popup window using selenium.GetWindow("popuwindowname"), selenium.GetWindow("title=something") or selenium.GetWindow("name=popupwindowname").
Has anyone had a similar problem and found a workaround or an alternative solution?

Can you put the html source of the popup window. Usually, what you see in the screen may different in the html code.

What type of popup dialog is returned if this is a modal dialog selenium does not handle modal dialogs.because a modal dialog stops all javascripts from running until it is closed.
see Selenium FAQ

Try this
public void testPopup() throws Exception {
selenium.open("http://yoursitename/page.aspx");
selenium.click("//img[#alt='Share']");
selenium.waitForPopUp("_blank", "30000");
selenium.selectPopUp("");
verifyTrue(selenium.isTextPresent("Recommend to a friend"));
selenium.close();
Hope will help you!

Related

Need to add 'popping up help window' function to About Dialog

I've designed my own help content for my RCP. And the pop up help window works properly for other common dialog, except the Help->About Dialog.
My purpose is once the user clicked the help button, the help window should be popped up successfully just like what eclipse does.
I set an help listener for the aboutAction in my code. Unfortunately it does not work.
aboutAction = ActionFactory.ABOUT.create(getWindow());
WorkbenchHelpSystem.getInstance().setHelp(aboutAction, IWorkbenchHelpContextIds.HELP_CONTENTS_ACTION);
aboutAction.setImageDescriptor(IDEInternalWorkbenchImages.getImageDescriptor(IDEInternalWorkbenchImages.IMG_OBJS_DEFAULT_PROD));
aboutAction.setHelpListener(new HelpListener()
{
public void helpRequested(HelpEvent event)
{
getWindow().getWorkbench().getHelpSystem().displayHelp();
}
});
menu.add(aboutAction);
menu.add(new GroupMarker("group.about.ext"));
I am just a beginner in eclipse rcps. Could anyone give me some suggestions?
If you want to know how something is implemented in Eclipse (in your case the about dialog) you could use the Plug-in Spy. Look in this stackoverflow answer for further details on how to use the plug-in spy.

nyroModal v2: How to validate form opened in iframe?

I'm trying to figure out how to validate a form opened using nyroModal.
The page is being opened as below on click of a button:
$(function() {
$('.btnedit').click(function() {
$.nmManual('form_page.php);
});
});
On the form that opens up, I have a few fields that are mandatory and a cancel & submit button.
<a class="nyroModalClose button" href="#" id="btn_submit">Submit</a>
On clicking of the submit button, I want to make sure the mandatory fields have value. If no, an error message should be displayed & the modal window should not close.
I'm trying to use the jquery validation plugin, but without success. The modal window always closes irrespective of the validation scripts.
I haven't found much info regarding form validation in a modal window. Is this not a preferred approach?
Thanks in advance.
I'm not able to help you about the jquery validation plugin in a modal window, but I know that using the instruction $.nmManual in that way, the form will not be placed inside the iframe tag, and if I remember correctly the content of new page will be added without header and body tags, so in a word incorrectly. I guess this can produce no validation.
To successfully open an iframe you need to use filters as described here:
Open iframe manually in nyroModal?
I hope this can help you.

Unable to locate WindowID

I am currently testing a web app using selenium rc with eclipse. I've been having issues with a single pop up window which appears when a submit button is clicked. The confirmation window appears with a single 'ok' option.
I've also tried 'chooseOKonnextConfirmation' in conjunction with .getConfirmation but eclipse tells me no confirmation exists. I've tried inspecting the window itself with firebug but have been unable to get any results.
I also tried with "selenium.selectWindow(getAllWindowIDs ()[1]);" but selenium not recognizing "getAllWindowIDs".
Could somebody please tell me how I can retrieve the windowID and the associated API commands I need to implement to get rid of this problem?
from your description, i understand that you have an ALERT window being appeared after clicking SUBMIT button but not the CONFIRMATION window.
if my understanding is correct
( you said single OK button - ALERT window appears with single OK button - CONFIRMATION window appears with OK and CANCEL buttons - there is another window javascript can generate which is CONFIRMATION.it appears with TEXT field and OK and CANCEL buttons )
so you must use accordingly.
here is what you should use
if(selenium.isAlertPresent()) {
String message = selenium.getAlert();
}
this will consume you Alert window and you can check the message displayed on Alert window if you want.
if this is not please post write your comment
It's selenium.getAllWindowIds(); note the capitalisation. Don't forget to make sure the popup has already appeared (e.g. selenium.waitForPopUp()).
Yes sudarsan is correct if you have an alert.
If you have an popup window not an alert with OK button then you have to click OK when popup appears.
If you are unable to locate the button use firebug to locate the element.

How to open an external web page from a Wicket modal dialog

I have a modal dialog in Wicket that contains a link. I need to open an external web page (for example, http://www.google.com) by clicking on the link. The target of the link is set dynamically. How can I do this?
I think that my question hasn't been so clear(I apologize for that). I need to open Web page from modal dialog. Actually, I can explain the problem in the example of modal dialog that #Don Roby has proposed me (wicketstuff.org/wicket14/ajax/modal-window.0). If we click the "Show modal dialog with a page" link in the example, there will be shown the modal dialog with another link called "Open another modal dialog". By clicking on that link, I want to open Web page (for example: www.google.com). My question is: how to open a Web page in this situation?
You can use a PageCreator (instead of setContent()), and return a RedirectPage:
ModalWindow modal = new ModalWindow("modal");
modal.setPageCreator(new ModalWindow.PageCreator() {
#Override
public Page createPage() {
return new RedirectPage("http://www.google.com");
}
});
add(modal);
I understand what you mean.
I have found the solution here :
http://apache-wicket.1842946.n4.nabble.com/How-to-redirect-from-a-ModalWindow-td1889646.html
onClick( AjaxRequestTarget target ){
target.appendJavascript( "Wicket.Window.unloadConfirmation = false;" );
modal.show( target);
}
It sounds like you already know how to deal with the modal, but there's an example of doing it here. Opening an external link is not difficult, and there's an example of doing it here.
how do you create your link ?
did you tried with an externalLink ?
new ExternalLink("applicationLink","http://www.google.com");

Submit form from greybox window to main window

I'm using greybox and trying the following thing: I want to make a form inside the pop-up so when the users submit's it, the request goes to the main window and the pop-up closes.
I know the way to close the window is by using onclick="parent.parent.GB_hide()", but I really haven't been able to find a way to make the pop-up close and the data sent to the corresponding controller when the form is submitted.
I'm using Zend FW.
Thanks in advance,
I really appreciate what this community does.
Just use this code given below at the end of the loop
parent.parent.GB_hide();