If you want to test your web application, the HttpUnit works fine. If
you want to test the combination of browser and web application, then
you're probably better off using Watir or Selenium.
I've never tried testing the javascript embedded in the page with
HttpUnit. From the messages I've seen on this list, that's not easy to
do. That's why I'm suggesting simulating what the javascript does.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of hari
prasanna
Sent: Thursday, March 09, 2006 12:56 AM
To: [email protected]
Subject: RE: [Httpunit-develop] How to access Java Script
associated with a button in a page and capture a new window.
Hi George,
One thing which prevents up accessing the login page directly by
forming the URL is, the app throws up error when accessed directly.
Moreover , its a requirement that i have to go through the first
page ,access the button or access the script directly and go to the next
page. In the way i also test for this page.
Please do let me know how i can go through this...
Thanks & Rgds,
Hari.
Subject: RE: [Httpunit-develop] How to access Java Script
associated
with a button in a page and capture a new window.
Date: Wed, 8 Mar 2006 08:18:50 -0600
From: <[email protected]>
To: <[email protected]>
Reply-To: [email protected]
Your test code doesn't need to execute the Javascript. Just
simulate
it
by opening "/app/login.jsp".
Date: Wed, 8 Mar 2006 12:43:34 +0000 (GMT)
From: hari prasanna <[email protected]>
To: [email protected]
Subject: [Httpunit-develop] How to access Java Script associated
with a
button in a page and capture a new window.
Reply-To: [email protected]
Hi ,
I am starting off workin on with the HTTP Unit. I am trying to
simulate a flow for login.
There is an Intial page , which contains a Button -Launch.
This
page doesnt ha ve any Forms.
There is a Java Script associated with the 'Launch' Button
,which on
click opens up the Login page in a "New Window".
I need to get this simulated and get the Login Page ,to do the
Login
into the App.
I am stuck in accessing the Java Script to simulate this flow.
Can someone provide me with ways how to get this done.
Refference : Page Details.
Button Description on the page:
<input id="launchBtn" type="button" value="Launch Web
Access" onclick="launch(false);">
Java Script:
function launch(accessibleMode) {
// Provoke the IE popup blocker
setTimeout(function(){launchWindow(accessibleMode)},
10);
}
funct ion launchWindow(accessibleMode) {
var loginPage = "/app/login.jsp";
if (accessibleMode) {
loginPage += "?accessible=true";
}
// Center the pop-up window on the screen, and default
it to
80% of
// available screen height and width (but no smaller
than
640x480 and
// no larger than 1024x768):
var scaleFactor = 0.80;
var popupWidth = 690; //Math.max(640, Math.min(1024,
Math.floor(screen.availWidth * scaleFactor)));
var popupHeight = 500; //Math.max(480, Math.min(768,
Math.floor(screen.avail Height * scaleFactor)));
var popupLeft = Math.max(0,
Math.round((screen.availWidth -
popupWidth) / 2));
var popupTop = Math.max(0,
Math.round((screen.availHeight -
popupHeight) / 2));
var wName = 'ocsweb_'+hName.replace(/\W/g,"");
try {
var w = window.open(loginPage, wName, 'width=' +
popupWidth
+ ',height=' + popupHeight + ',left=' + popupLeft + ',top=' +
popupTop
+ ',resizable=yes,status=yes');
if (w == null) {
popupWarn();
}
else {
w.focus();
}
}
catch(e) {
popupWarn();
}
};
Thanks ,
Hari.
Send instant messages to your online friends
http://in.messenger.yahoo.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.