|
请教大家想用httpunit提交表单的测试,为什么简单的访问百度,淘宝都报错呢。而有的网站就不会报错,是我的js.jar包的问题?还是网站有做安全设置呢?
public static void main(String[] args) {
WebConversation wc= new WebConversation();
try{
WebResponse wr=wc.getResponse("http://www.taobao.com");
System.out.println(wr.getText());
}catch(IOException e){
e.printStackTrace();
}catch(SAXException e){
e.printStackTrace();
}
}
KISSY.add("event/object",function(b,c){function j(a,b,c){this.currentTarget=a;this.originalEvent=b||{};b?(this.type=b.type,this._fix())this.type=c,this.target=a);this.currentTarget=a;this.fixed=!0}var f=document,h="altKey,attrChange,attrName,bubbles,button,cancelable,charCode,clientX,clientY,ctrlKey,currentTarget,data,detail,eventPhase,fromElement,handler,keyCode,metaKey,newValue,offsetX,offsetY,originalTarget,pageX,pageY,prevValue,relatedNode,relatedTarget,screenX,screenY,shiftKey,srcElement,target,toElement,view,wheelDelta,which,axis".split(",");b.augment(j,
{_fix:function(){for(var a=this.originalEvent,b=h.length,d,e=this.currentTarget,e=9===e.nodeType?e:e.ownerDocument||f;b;)d=h[--b],this[d]=a[d];this.target||(this.target=this.srcElement||f);3===this.target.nodeType&&(this.target=this.target.parentNode);!this.relatedTarget&&this.fromElement&&(this.relatedTarget=this.fromElement===this.target?this.toElement:this.fromElement);this.pageX===c&&this.clientX!==c&&(a=e.documentElement,b=e.body,this.pageX=this.clientX+(a&&a.scrollLeft||b&&b.scrollLeft||0)-
(a&&a.clientLeft||b&&b.clientLeft||0),this.pageY=this.clientY+(a&&a.scrollTop||b&&b.scrollTop||0)-(a&&a.clientTop||b&&b.clientTop||0));this.which===c&&(this.which=this.charCode===c?this.keyCode:this.charCode);this.metaKey===c&&(this.metaKey=this.ctrlKey);!this.which&&this.button!==c&&(this.which=this.button&1?1:this.button&2?3:this.button&4?2:0)},preventDefault:function(){var a=this.originalEvent;a.preventDefault?a.preventDefault():a.returnValue=!1;this.isDefaultPrevented=!0},stopPropagation:function(){var a=
t{this.log("later");this._fillHTML(K,J)},300,false,this)}}}});return G},{requires:["fp/util","fp/module","dom"]});' failed: org.mozilla.javascript.EvaluatorException: missing ) after argument list (httpunit#28)
at com.meterware.httpunit.javascript.ScriptingEngineImpl.handleScriptException(ScriptingEngineImpl.java:64)
at com.meterware.httpunit.javascript.ScriptingEngineImpl.runScript(ScriptingEngineImpl.java:95)
at com.meterware.httpunit.scripting.ScriptableDelegate.runScript(ScriptableDelegate.java:88)
at com.meterware.httpunit.parsing.NekoDOMParser.runScript(NekoDOMParser.java:151)
at com.meterware.httpunit.parsing.ScriptFilter.getTranslatedScript(ScriptFilter.java:150)
at com.meterware.httpunit.parsing.ScriptFilter.endElement(ScriptFilter.java:131)
at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:249)
at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:367)
at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1015)
at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:888)
at org.cyberneko.html.HTMLScanner$SpecialScanner.scan(HTMLScanner.java:2831)
at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:809)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:478)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:431)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at com.meterware.httpunit.parsing.NekoHTMLParser.parse(NekoHTMLParser.java:48)
at com.meterware.httpunit.HTMLPage.parse(HTMLPage.java:271)
at com.meterware.httpunit.WebResponse.getReceivedPage(WebResponse.java:1301)
at com.meterware.httpunit.WebResponse.getFrames(WebResponse.java:1285)
at com.meterware.httpunit.WebResponse.getFrameRequests(WebResponse.java:1024)
at com.meterware.httpunit.FrameHolder.updateFrames(FrameHolder.java:179)
at com.meterware.httpunit.WebWindow.updateFrameContents(WebWindow.java:315)
at com.meterware.httpunit.WebClient.updateFrameContents(WebClient.java:526)
at com.meterware.httpunit.WebWindow.updateWindow(WebWindow.java:201)
at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:183)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:158)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:125)
at com.meterware.httpunit.WebClient.getResponse(WebClient.java:96)
at day01.Test01.main(Test01.java:18) |
|