RE: How to access Java Script associated with a button in a page and capture a new window.

<[email protected]>
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <652366DEEF97A3438EC2F4669BD66BA58A78D4@msgswbmnmsp31.wellsfargo.com>
Your test code doesn't need to execute the Javascript.  Just simulate it
by opening "/app/login.jsp".

	-----Original Message-----
	From: [email protected]
[mailto:[email protected]] On Behalf Of hari
prasanna
	Sent: Wednesday, March 08, 2006 7:44 AM
	To: [email protected]
	Subject: [Httpunit-develop] How to access Java Script associated
with a button in a page and capture a new window.
	
	
	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.availHei ght * 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();
	        }
	    &nbs p; }
	      catch(e) {
	        popupWarn();
	      }
	    };
	
	Thanks ,
	Hari.
	

	
  _____  

	Jiyo cricket on Yahoo! India cricket
<http://us.rd.yahoo.com/mail/in/mailcricket/*http://in.sports.yahoo.com/
cricket/> 
	Yahoo! Messenger Mobile
<http://us.rd.yahoo.com/mail/in/mailmobilemessenger/*http://in.mobile.ya
hoo.com/new/messenger/>  Stay in touch with your buddies all the time.
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.