Re: Problems with IFrames
Allwyn D'souza <[email protected]>
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
No, not really. No error message if i load the lower frame and set the form values (username and password) and then submit the form. It seems like it keep loading the same page. Does not load the page that should display after the user is logged in.
Is there something im doing wrong?
Following is the code snippet of various pages.
//Login.html (main page that is loaded - this page embed the IFrame).
<html><Head><Script><!--
function SetLoginForm(name, password, Submit) { document.loginForm.name.value = name; document.loginForm.password.value = password; document.loginForm.submit();}--></Script></Head>
<Body><Form name="loginForm" action="/LoginController" method="Post">
<input type="hidden" name="name" value="" /><input type="hidden" name="password" value="" /></Form>
<Center><IFrame name="login" id="login" src="LoginDialog.html" /></Center></Body>
</html>
// LoginDialog.html - IFrame
<html><Head><Script><!--
function SubmitToParent(action) { parent.SetLoginForm(document.submit_to_parent.name.value,document.submit_to_parent.password.value);
}--></Script></Head>
<Body><Form id=f1 name="submit_to_parent" method="Post">
<input type="text" name="name" value="" /><input type="text" name="password" value="" />
<input type="submit" name="Ok" value="login" onClick="SubmitToParent('Submit')" /></Form>
</Body>
</html>
// Login.java - HttpUnit Testcase
public void testLogin() {
this.response = conversation.getCurrentPage()' WebResponse bottomFrame = conversation.getFrameContents("login"); // load the <Iframe> WebForm form = bottomFrame.getFormWithName("submit_to_parent"); form.setParameter("user","aa"); form.setParameter("password","xx"); this.response = form.submit(); // This response contains the same page, does not log the user in. Load the same //page}
Thanks.
Regds,
Al.
Date: Sun, 23 Mar 2008 13:22:01 -0400From: [email protected]: [email protected]: Re: [Httpunit-develop] Problems with IFrames
Are you getting any error messages?On Mar 21, 2008, at 10:56 AM, Allwyn D'souza wrote:
Hi Guys, Im using HttpUnit to write test cases. My web application uses <Iframes> to login to the application. To simplify, i have a login page. This page has a javascript function (loginIntoApp) that accepts username and password as parameters to the method. This method sets the username and password to the hidden field and then post the form to a given action. The login page embeds an <IFrame> called "ChildFrame.html". This frame has an html form that accepts "username" and "password" from the user. On the submit of this form, a javascript is called which in turn calls the javascript of its parent (loginIntoApp), mentioned above. I tried different things to write a test cases that login into the app, but i could not login. It works fine if i login using the web browser. Any suggestions or solution would be appreciated? Thanks. Al.
When was the last time you saw your friends or family? Free unlimited Video Calls from Windows Live Messenger - download it here for FREE! Click here! -------------------------------------------------------------------------This SF.net email is sponsored by: MicrosoftDefy all challenges. Microsoft(R) Visual Studio 2008.http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________Httpunit-develop mailing [email protected]://lists.sourceforge.net/lists/listinfo/httpunit-develop
_________________________________________________________________
Messenger likes to chat, one on one..or to everyone! Welcome to the Family – Download the Windows Live Messenger now
http://get.live.com/mail/overview
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop