views:

422

answers:

1

hi..

looked through the 'net, as well as other replies on here..

i've got something that looks like the following html:

var langId = '-1';
var demoKey = 'null';
var extraParams = 'null'; // only used for User Registration page
var multiSelect = false;

and

function onCampusSelect_USA() {
    if($('campusUSAIdSelect').value == ''){clearAJAXTimer();hideLayer("programUSADiv");   hideLayer("errorDiv");    hideLayer("buttonDivUS"); return; }
    // REMOVE THIS LATER
    clearAJAXTimer();
    getData(buildParms('PROGRAMSUS','US','campusId='+$('campusUSAIdSelect').value + "&institutionId=" +  $('institutionUSAIdSelect').value));
}

i've tried the following with no luck

WebClient webClient = new WebClient(BrowserVersion.FIREFOX_3);
webClient.setJavaScriptEnabled(true);
HtmlPage page = webClient.getPage("http://www.foo.com/");
ScriptResult scriptResult = page.executeJavaScript("${'multiSelect'}");
System.out.println(scriptResult.getJavaScriptResult());

so.. i'm trying to figure out just what should go in the execute line..

ScriptResult scriptResult = page.executeJavaScript( what goes here?? );

something like

document.mutliSelect.value() <<<< (which doesn;t work by the way..)

thanks

A: 

type the following into your browser navigation bar:

javascript:alert("hello!")

Using this technique, you can execute JavaScript commands. For HtmlUnit, replace "what goes here??" by the stuff you would type into the navigation bar without the "javascript:" part.

James Kingsbery