--- Werner G Mathis <[EMAIL PROTECTED]> wrote: > Hi all, > > I am trying to automate user responses to a web > application via a perl > script which controls MS Internet Explorer. For that > my perl script starts > MSIE, navigates to the application, and enters the > required data. Now, when > navigating to the web application, the web server > sends me a html page > which contains a javascript function like the > following: > ... > <SCRIPT language=JavaScript> > function showDetails(action,keydetail) { > > document.assetList.action = action; > document.assetList.Key.value = keydetail; > document.assetList.submit(); > return false; > } > </SCRIPT> > ... > > I need to call this function in order to have the > next page of the > application being displayed. How can I call this > java script function from > within my .pl script (The parameters 'action' and > 'keydetail' are known by > the perl script), which looks like: > > use OLE; > $IExplorer = CreateObject OLE > "InternetExplorer.Application" || > die "CreateObject: $!"; > $IExplorer->{Visible} = 1; > $IExplorer->Navigate('<web application url>'); # > Application sends back a > html containing a JavaScript function > ... > > The only thing I have found so far is 'execScript' > from MSIEs object model, > but the following code doesn't work and there seems > to be almost no > information nor samples on Microsofts Web pages on > how to use that: > $IExplorer->execScript('showDetails()', > 'JavaScript'); > > Has anybody experience in this area or can anybody > give me a pointer?
Perhaps try a Javascript solution instead?! Try adding an onload() event handler to the web page's body tag, and have it execute the Javascript function, as follows: <body onLoad='showDetails()'> Which, however, may not work, if the action and keydetails are _not_ known to the Javascript. To share data between the two programming languages, you might need to look at using a 'web service', or, more simply, WDDX (see http://openwddx.org). There is a Perl module for this: WDDX.pm, and there are specific Perl2Javascript (and vice versa) functions. Hope these ideas help. ===== George M. Jempty Database Admin/Intranet Architect Regional West Medical Center Scottsbluff, Nebraska [EMAIL PROTECTED][EMAIL PROTECTED] __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com _______________________________________________ Perl-Win32-Web mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web