通过'网络以及此处的其他回复查看..
我有一些看起来像下面的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));
}
我试过以下但没有运气
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());
所以..我正试图找出应该在执行行中的内容..
ScriptResult scriptResult = page.executeJavaScript( what goes here?? );
类似
document.mutliSelect.value() <<<< (which doesn;t work by the way..)
感谢
答案 0 :(得分:2)
在浏览器导航栏中输入以下内容:
的javascript:警报( “你好!”)
使用此技术,您可以执行JavaScript命令。对于HtmlUnit,请替换“what goes here ??”您可以在没有“javascript:”部分的情况下输入导航栏中的内容。