htmlunit JavaScript 问题
浏览了“网络”以及这里的其他回复..
我得到了一些类似于以下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..)
谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在浏览器导航栏中输入以下内容:
javascript:alert("hello!")
使用此技术,您可以执行 JavaScript 命令。对于 HtmlUnit,替换“这里有什么??”通过您在导航栏中输入的内容(不带“javascript:”部分)。
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.