51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1820|回复: 1
打印 上一主题 下一主题

[求助] HttpUnit测试请教

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2012-11-2 01:13:40 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
请教大家想用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)
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2012-11-5 21:04:21 | 只看该作者
卡住了 真心不会
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-10 15:53 , Processed in 0.084750 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表