51Testing软件测试论坛

标题: 参数化后回放时报500错误 [打印本页]

作者: hgl    时间: 2010-11-16 17:23
标题: 参数化后回放时报500错误
我测试的是会员报单功能,会员选择:省、市、输入详细地址,国家、省、市这些都放在数据库里。
选择省下拉框后,会找出对应的市放在“市”下拉框里。
我把省、市都参数化了,回放的时候报下面的错误:
Action.c(149): Error -26612: HTTP Status-Code=500 (Internal Server Error) for "http://172.16.10.251/yofoto/Store/DeclarationsCenter/Retail.aspx"          [MsgId: MERR-26612]
Action.c(149): web_submit_data("Retail.aspx_4") highest severity level was "ERROR", 7611 body bytes, 485 header bytes          [MsgId: MMSG-26388]
作者: hgl    时间: 2010-11-16 17:29
本帖最后由 hgl 于 2010-11-16 17:30 编辑

在脚本里把省市详细地址改为固定的值也报同样的错误。我想可能是需要关联,录两次脚本对比之后发现只有一个地方有不同。但不知道如何关联。下面是提交表单时的脚本,红色的为有不同的地方。
web_submit_data("Retail.aspx_4",
                "Action=http://172.16.10.251/yofoto/Store/DeclarationsCenter/Retail.aspx",
                "Method=POST",
                "RecContentType=text/html",
                "Referer=http://172.16.10.251/yofoto/Store/DeclarationsCenter/Retail.aspx",
                "Snapshot=t10.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=__VIEWSTATE", "Value=", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$RadioList_PayMode", "Value=1", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$txt_bianhao", "Value={memberBH2}", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$DrpList_ReceMode", "Value=0", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$txt_Postcode", "Value=222222", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$txt_MobileTel", "Value=13922222222", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$DropdownAddress1$DropDownCountry", "Value=中国", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$DropdownAddress1$DropDownProvince", "Value=浙江省", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$DropdownAddress1$DropDownCity", "Value=杭州市", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$DropdownAddress1$txtkeyWord", "Value=sdfsdf", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$DropdownAddress1$txtAddress", "Value=中国·浙江省·杭州市·sdfsdf", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$RadioList_Delivery", "Value=1", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$gvProductList$ctl02$HidId", "Value=2", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$gvProductList$ctl02$HidPrice", "Value=200.23", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$gvProductList$ctl02$HidPv", "Value=250.00", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$gvProductList$ctl02$txtProCount", "Value=1", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$gvProductList$ctl02$HidPv2", "Value=10.00", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$gvProductList$ctl03$HidId", "Value=3", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$gvProductList$ctl03$HidPrice", "Value=200.00", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$gvProductList$ctl03$HidPv", "Value=250.00", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$gvProductList$ctl03$txtProCount", "Value=1", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$gvProductList$ctl03$HidPv2", "Value=50.00", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$btnPersion", "Value=确定", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$HidId", "Value=", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$HidIdInfo", "Value=2,3", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$HidNumInfo", "Value=1,1", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$HidMode", "Value=add", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$HidRbkId", "Value=", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$HidbhExist", "Value=false", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$HidName", "Value=会员姓名:{memberBH2_name}", ENDITEM,
                "Name=ctl00$HidType", "Value=0", ENDITEM,
                "Name=__EVENTTARGET", "Value=", ENDITEM,
                "Name=__EVENTARGUMENT", "Value=", ENDITEM,
                "Name=__LASTFOCUS", "Value=", ENDITEM,
                "Name=__EVENTVALIDATION", "Value=PLxXyStaYiNjE8URNJBOy13ZXTO/+fU6fxIAEO5XLnxwwtpQv5BvmyOAwaY2qGuQQKhsSgqXWcjhYIPPdS26OxoR0KMy8UgnhGr9P27dVVygfYO2AyFMFBlelyzCVvWRW/8V5BT2WXfMrA7bxfhY14J3zAEdeEaGGgGsUoxlwPQkVgZ1zn4I1upvRbf1q58aVYWUub9DEVpl9pKt/BE3tV2leWCQQXYmkznHFcDDBykcflhA+kw2AqyduwIOod+FVv4oa6fObrRFcFz9Fxz79nvPXQpD2ormXoPVRwl6gKwQHXWMcNCqM2G5b+pKJ9JFuoG3JsettIWp8np2ALrRVPi4sJXT9JyqVMzZWpi/MIhZg3uD1Mdzd2utqsFKFZlq5/9T0yfp7g61xMiX1dcZBRADzX/gVdtd4INBEit869+MrElAozMCDVtt9/"
                "NZmOELYG81DmCInca8HLye5q7ikJz6BpepWWiYshZyDeNibiNCK2fZ5gtJyZcw3a53DoNbtvs6Q/QniSODE9ycpdqU5stmL3n62/y/sMeZotdjjC5jqBNNiPO6J3CmSZKi8mG3Lq/TUq1nirzu5bpvdhUGW3WonX7ap1IEhAbevQNbeWDoZpegQd3OFVjvs1KK6JffNEDTf0S2NAfCI4R7wGTPh3/q8tds1orFqI64Dgsy9LSP+09sd2eZadxgTK3vSuaKGCC9eUEXqjnxAnAGblCe7uO2l42Am+fO2sSOC88id06doq5DIVwD00iDBlJGi9xHBBuzcyZAhrvDOFNn6RiLmw==", ENDITEM,
                "Name=__VIEWSTATEENCRYPTED", "Value=", ENDITEM,
                EXTRARES,
                "Url=/yofoto/WebResource.axd?d=Aq2sJVOkDYYlyXyxGWOHcw2&t=634233408736276250", ENDITEM,
                LAST);
作者: jadeyu712    时间: 2010-11-16 18:40
说明服务器有错误。你可以使用动态关联试一下
作者: hgl    时间: 2010-12-1 23:31
不能进行自动关联,菜单是灰色的
作者: qzj_test    时间: 2010-12-2 09:11
这个省市联动是不是用Ajax做的
作者: hgl    时间: 2010-12-2 11:05
是用Ajax做的,我录制的协议选的是单协议WEB(HTTP/HTML),
作者: myallways    时间: 2010-12-2 11:53
我看你的脚本是通过Html方式录制的,建议你使用URl,自动关联之前要回放,按钮不应该置灰!!
作者: myallways    时间: 2010-12-2 11:54
我看你的脚本是通过Html方式录制的,建议你使用URl,自动关联之前要回放,按钮不应该置灰!!
作者: hgl    时间: 2010-12-2 13:28
HTML 与URL方式一样,回放后,按ctrl+F8后,没找到要关联的地方,
作者: jarystar    时间: 2010-12-2 16:40
我回放后也没关联显示,但是日志上会显示出来!你可以关联后看看日志,然后运行就能跑通了!
作者: hgl    时间: 2010-12-2 19:53
怎么做关联呢?我不知道那些值是从哪来的,
作者: qiguojie    时间: 2010-12-3 10:18
我认为这种关联的数据获取,最后提交业务请求的时候影响应该不是很大。。只要参数化搞定就应该没有问题。
作者: fishbigsea    时间: 2010-12-3 12:13
建议你先把run time里面的log勾选了扩展日志那几个选项,然后看看什么原因,贴出来。 光500的错误 可能是很多东西引起的,我遇到过一个是因为内容含有敏感字符,在ASPX里加了2个属性解决的。
作者: fishbigsea    时间: 2010-12-3 12:14
EnableViewStateMac="false" EnableEventValidation="false"  
在里面加这2个属性。
作者: hgl    时间: 2010-12-3 22:58
日志里是这样的:

   [ArgumentException]: Invalid postback or callback argument.  Event validation is enabled u
Action.c(175):     sing <pages enableEventValidation="true"/> in configuration or <%@ Page
Action.c(175):      EnableEventValidation="true" %> in a page.  For security purposes, this feat
Action.c(175):     ure verifies that arguments to postback or callback events originate from the server contr
Action.c(175):     ol that originally rendered them.  If the data is valid and expected, use the ClientScript
Action.c(175):     Manager.RegisterForEventValidation method in order to register the postback or callback da
Action.c(175):     ta for validation.\r\n
Action.c(175):        at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument)\r\n
Action.c(175):        at System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument)\r\n
Action.c(175):        at System.Web.UI.WebControls.DropDownList.LoadPostData(String postDataKey, NameValueCol
Action.c(175):     lection postCollection)\r\n
Action.c(175):        at System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.LoadPostDa
Action.c(175):     ta(String postDataKey, NameValueCollection postCollection)\r\n
Action.c(175):        at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad
Action.c(175):     )\r\n
Action.c(175):        at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean
Action.c(175):      includeStagesAfterAsyncPoint)\r\n
Action.c(175):     [HttpUnhandledException]: Exception of type 'System.Web.HttpUnhandledException' wa
Action.c(175):     s thrown.\r\n
Action.c(175):        at System.Web.UI.Page.HandleError(Exception e)\r\n
Action.c(175):        at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean
Action.c(175):      includeStagesAfterAsyncPoint)\r\n
Action.c(175):        at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean inc
Action.c(175):     ludeStagesAfterAsyncPoint)\r\n
Action.c(175):        at System.Web.UI.Page.ProcessRequest()\r\n
Action.c(175):        at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)\r\n
Action.c(175):        at Sy
Action.c(175): t=46166ms: 632-byte response body for "http://172.16.10.251/yofoto/Store/DeclarationsCenter/Retail.aspx" (RelFrameId=1, Internal ID=96)
Action.c(175):     stem.Web.UI.Page.ProcessRequest(HttpContext context)\r\n
Action.c(175):        at ASP.store_declarationscenter_retail_aspx.ProcessRequest(HttpContext context)\r\n
Action.c(175):        at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExec
Action.c(175):     utionStep.Execute()\r\n
Action.c(175):        at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchr
Action.c(175):     onously)\r\n
Action.c(175):     --><!-- \r\n
Action.c(175):     This error page might contain sensitive information because ASP.NET is configured to show
Action.c(175):     verbose error messages using <customErrors mode="Off"/>. Consider using <customEr
Action.c(175):     rors mode="On"/> or <customErrors mode="RemoteOnly"/> in production environments.
Action.c(175):     -->
Action.c(175): Error -26612: HTTP Status-Code=500 (Internal Server Error) for "http://172.16.10.251/yofoto/Store/DeclarationsCenter/Retail.aspx"
作者: hgl    时间: 2010-12-3 23:03
下面是选择“仅输出错误信息”的日志:
Start auto log messages stack - Iteration 1.
Action.c(175):        at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExec
Action.c(175):     utionStep.Execute()\r\n
Action.c(175):        at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchr
Action.c(175):     onously)\r\n
Action.c(175):     --><!-- \r\n
Action.c(175):     This error page might contain sensitive information because ASP.NET is configured to show
Action.c(175):     verbose error messages using &lt;customErrors mode="Off"/&gt;. Consider using &lt;customEr
Action.c(175):     rors mode="On"/&gt; or &lt;customErrors mode="RemoteOnly"/&gt; in production environments.
Action.c(175):     -->
Action.c(175): Error -26612: HTTP Status-Code=500 (Internal Server Error) for "http://172.16.10.251/yofoto/Store/DeclarationsCenter/Retail.aspx"          [MsgId: MERR-26612]
End auto log messages stack.

Start auto log messages stack - Iteration 1.
Action.c(175): t=22630ms: Closing connection to 172.16.10.251 after receiving status code 500          [MsgId: MMSG-26000]
Action.c(175): t=22636ms: Closed connection to 172.16.10.251:80 after completing 29 requests          [MsgId: MMSG-26000]
Action.c(175): t=22636ms: Request done "http://172.16.10.251/yofoto/Store/DeclarationsCenter/Retail.aspx"          [MsgId: MMSG-26000]
Action.c(175): Error -26366: "Text=
        零售报单
" not found for web_reg_find          [MsgId: MERR-26366]
End auto log messages stack.
作者: hgl    时间: 2010-12-3 23:06
本帖最后由 hgl 于 2010-12-3 23:08 编辑

出错的步骤:修改了收货地址
web_submit_data("Retail.aspx_5",
                "Action=http://172.16.10.251/yofoto/Store/DeclarationsCenter/Retail.aspx",
                "Method=POST",
                "TargetFrame=",
                "RecContentType=text/html",
                "Referer=http://172.16.10.251/yofoto/Store/DeclarationsCenter/Retail.aspx",
                "Snapshot=t11.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=__VIEWSTATE", "Value=", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$RadioList_PayMode", "Value=1", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$txt_bianhao", "Value=610000211", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$DrpList_ReceMode", "Value=0", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$txt_Postcode", "Value=111111", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$txt_MobileTel", "Value=13922223333", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$DropdownAddress1$DropDownCountry", "Value=中国", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$DropdownAddress1$DropDownProvince", "Value=河南省", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$DropdownAddress1$DropDownCity", "Value=信阳市", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$DropdownAddress1$txtkeyWord", "Value=88888888浙江温州", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$DropdownAddress1$txtAddress", "Value=中国·河南省·信阳市·88888888浙江温州", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$RadioList_Delivery", "Value=1", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$gvProductList$ctl02$HidId", "Value=2", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$gvProductList$ctl02$HidPrice", "Value=200.23", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$gvProductList$ctl02$HidPv", "Value=250.00", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$gvProductList$ctl02$txtProCount", "Value=1", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$gvProductList$ctl02$HidPv2", "Value=10.00", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$btnPersion", "Value=确定", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$HidId", "Value=", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$HidIdInfo", "Value=2", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$HidNumInfo", "Value=1", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$HidMode", "Value=add", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$HidRbkId", "Value=", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$HidbhExist", "Value=false", ENDITEM,
                "Name=ctl00$ContentPlaceHolder1$HidName", "Value=会员姓名:温州", ENDITEM,
                "Name=ctl00$HidType", "Value=0", ENDITEM,
                "Name=__EVENTTARGET", "Value=", ENDITEM,
                "Name=__EVENTARGUMENT", "Value=", ENDITEM,
                "Name=__LASTFOCUS", "Value=", ENDITEM,
                "Name=__EVENTVALIDATION", "Value=c+EKMfuLYLgrZuyJGhnW07c5RS9H3LBf6XXnatRE/id/45zvPZLZTh2B/hwk9ISSVfDnFwMNgnwDmP1zGV7bHMte4ywimO6tPZ0LVC0UPRSWJ1AIZIRUUHOMCVn3PhYBoTB92OhzN9UPaeeBSHxb0bRJcoY7ArpcyBkbpDuSFLghJ7oLUB0MLzny14KYhnvAfhCbsJs2ZlwZVXD2j2i2ZyDLVvnehNKBLdBg0UAAjiR2uuwptADiHZgC2hunhTtE13LR58mfJMHbkaC1vw47ASmFAshjBfXhzd9zMUeayl6s0OiMmVZiN2HldfoJG/KJeiwemnMlalaaWlAXt/Mf5+"
                "7j11ZmxrX0nQG5O6JEbHuYl0bpCwEjPed9qTzWOe6Jgp6TBf3oVZXsIQ8uu4s1BqCQoSWyljbFCDRfVBOilCPepRejIwfOagiVNGTWvav0DocmVYtWydTJm1pvNWQQ1Ucq+QUJAp6rhvdxlJ7R1iRy4ixTljZyGlF+XtYh9Lm8edDG9xmCDoH/we2nKtYmrSnP58Vcn49E6u5Iu0N1gPxezT6ArhACTFrelN6mLnf7CK4cXaVJ8/jT+trDmlYtWDieuUdTU+zVcOaKT4MqsKv+K90wwK5zAqIReyqN4bMrAvwMK5yDAfKnUKXDOf1V/fkD03FZ6Qj/nG4NWZKmWGspuNNKJYbMAVxHtxCaYcY/BYL/bVu2auDg5WIvdgO3MRinlGFZBXoswq4OZJHR8KOLax9PJbgItGQYR91gGlgUWx7DDukb4t3owReK2Ln9OBW9xB2NPqUIf8H/UiAr4IA=", ENDITEM,
                "Name=__VIEWSTATEENCRYPTED", "Value=", ENDITEM,
                LAST);
作者: C组十三    时间: 2010-12-5 15:43
建议按照上面请求的内容,手工操作一次,看能否成功。
至于关联,自动关联不了,就写代码做个关联好了。
作者: hgl    时间: 2010-12-5 19:49
手工关联,不知道Name=__EVENTVALIDATION", "Value=后面值的左右边界,应该怎么弄呢,也不知道这些值是哪个操作步骤产生的。
作者: fishbigsea    时间: 2010-12-6 13:44
日志里是这样的:

   [ArgumentException]: Invalid postback or callback argument.  Event validation is enabled u
Action.c(175):     sing <pages enableEventValidation="true"/> in configuration or <%@ Page
Action.c(175):      EnableEventValidation="true" %> in a page.  For security purposes, this feat
Action.c(175):     ure verifies that arguments to postback or callback events originate from the server contr
Action.c(175):     ol that originally rendered them.

把aspx页面打开,加 enableEventValidation="false" 再试试,不行的话,删掉这个属性试试。

添加 EnableViewStateMac="false" EnableEventValidation="false"  这2个属性也没有用么?
作者: fishbigsea    时间: 2010-12-6 13:47
回复 19# hgl



    这个值在HTML的源码里面,我觉得可能是打开这个页面的时候系统自动产生的。右边界你可以设置为双引号前面加反斜杠,或者为空
作者: C组十三    时间: 2010-12-6 22:54
左边界="Name=__EVENTVALIDATION", "Value=
右边界==", ENDITEM,
作者: hgl    时间: 2010-12-7 11:17
在页面上加入enableEventValidation="false"正常了~~,感谢各位的帮助
作者: ilove51    时间: 2010-12-7 12:03
学习了,真强。




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2