How to access Java Script associated with a button in a page and capture a new window.
hari prasanna <[email protected]>
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[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 have 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);
}
function 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.availHeight * 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.
---------------------------------
Jiyo cricket on Yahoo! India cricket
Yahoo! Messenger Mobile Stay in touch with your buddies all the time.