web_submit_data不在LoadRunner脚本中重播(LR 11.50)

时间:2013-11-04 14:57:50

标签: loadrunner

我有一个应用程序,可以将任何长URL转换为这样的短网址:https://{HOST}/short_link_name,我的目标是制作工作脚本。

用户在浏览器中打开https://{HOST},传递带有凭据的身份验证表单,并查看用于将长URL转换为短URL的表单。 表单由3个输入字段组成:

{long_URL} - is any long URL which user need to convert into short URL
{short_URL_name} - is the name of link given by user for short URL
and the 3rd isn't important in this context.

然后用户点击按钮提交数据,并可以看到结果 - 此表单下方的简短URL链接。

所以,我制作了手动脚本,脚本片段在这里:

web_url("{HOST}", 
    "URL=https://{HOST}/", 
    "Resource=0", 
    "RecContentType=text/html", 
    "Referer=", 
    "Mode=HTML", 
    EXTRARES, 
    "Url=//Grid/GetLinks?_dc=1383645884804&page=1&start=0&limit=6", ENDITEM,
    "Url=//Grid/GetLinks?_dc=1383645898655&page=1&start=0&limit=6", ENDITEM,
            "Url=/GetImage/Methodology?width=200&height=200", ENDITEM,
    LAST);

... (verifying that my username is displayed on the application page = I'm logged in)

web_submit_data("Register",
        "Action=https://{HOST}/UrlRegistration/Register", 
        "Method=POST", 
        "RecContentType=application/json", 
        "Referer=https://{HOST}/", 
        "Mode=HTML", 
        ITEMDATA, 
        "Name=ShortUrl", "Value={short_URL_name}", ENDITEM, 
        "Name=LongUrl", "Value=http://{long_URL}", ENDITEM, 
        "Name=Persistent", "Value=false", ENDITEM, 
        LAST);

注意:

1)像_dc=1383645884804这样的值是时间戳;

2)我已成功登录应用程序页面;

3)https://{HOST}/UrlRegistration/Register实际上并不存在于提交申请表格的HTML代码中。

问题是,当我运行脚本时,对于这个片段我有下一个文本的错误:

Action.c(65): web_submit_data("Register") started
Action.c(65): Error -26627: HTTP Status-Code=404 (Not Found) for "https://{HOST}/UrlRegistration/Register"
Action.c(65): web_submit_data("Register") highest severity level was "ERROR", 1245 body bytes, 287 header bytes

此表单的HTML代码段:

<form action="/" method="post">
 ...
</form>

为什么我在web_submit_data中出现此错误,如何才能正确使用脚本?你能帮帮我吗?

使用选中的选项“服务器返回的数据”在扩展日志中我有下一个:

Action.c(32): web_submit_data("Register") started   [MsgId: MMSG-26355]
Action.c(32): t=123159ms: 308-byte response headers for "https://{HOST}/UrlRegistration/Register" (RelFrameId=1, Internal ID=22)
Action.c(32):     HTTP/1.1 401 Unauthorized\r\n
Action.c(32):     Cache-Control: private\r\n
Action.c(32):     Content-Type: text/html\r\n
Action.c(32):     Server: Microsoft-IIS/7.5\r\n
Action.c(32):     X-AspNetMvc-Version: 4.0\r\n
Action.c(32):     X-AspNet-Version: 4.0.30319\r\n
Action.c(32):     WWW-Authenticate: Negotiate\r\n
Action.c(32):     WWW-Authenticate: NTLM\r\n
Action.c(32):     X-UA-Compatible: IE=Edge, chrome=1\r\n
Action.c(32):     Date: Tue, 05 Nov 2013 10:15:18 GMT\r\n
Action.c(32):     Content-Length: 1293\r\n
Action.c(32):     \r\n
Action.c(32): t=123229ms: 1293-byte response body for "https://{HOST}/UrlRegistration/Register" (RelFrameId=1, Internal ID=22)
Action.c(32):     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/
Action.c(32):     xhtml1-strict.dtd">\r\n
Action.c(32):     <html xmlns="http://www.w3.org/1999/xhtml">\r\n
Action.c(32):     <head>\r\n
Action.c(32):     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>\r\n
Action.c(32):     <title>401 - Unauthorized: Access is denied due to invalid credentials.</title>\r\n
Action.c(32):     <style type="text/css">\r\n
...
Action.c(32):     </style>\r\n
Action.c(32):     </head>\r\n
Action.c(32):     <body>\r\n
Action.c(32):     <div id="header"><h1>Server Error</h1></div>\r\n
Action.c(32):     <div id="content">\r\n
Action.c(32):      <div class="content-container"><fieldset>\r\n
Action.c(32):       <h2>401 - Unauthorized: Access is denied due to invalid credentials.</h2>\r\n
Action.c(32):       <h3>You do not have permission to view this directory or page using the credentials that you supplied.</h3>\r\n
Action.c(32):      </fieldset></div>\r\n
Action.c(32):     </div>\r\n
Action.c(32):     </body>\r\n
Action.c(32):     </html>\r\n
Action.c(32): t=123387ms: 506-byte response headers for "https://{HOST}/UrlRegistration/Register" (RelFrameId=1, Internal ID=22)
Action.c(32):     HTTP/1.1 401 Unauthorized\r\n
Action.c(32):     Content-Type: text/html; charset=us-ascii\r\n
Action.c(32):     Server: Microsoft-HTTPAPI/2.0\r\n
Action.c(32):     WWW-Authenticate: NTLM TlRMTVNTUAACAAAACgAKADgAAAAFgomiq9WGN92mlIoAAAAAAAAAAKwArABCAAAABgGxHQAAAA9NAEkATgBTAEsAAgAKAE0ASQBOAFMASwABABoARQBWAEIAWQBNAEkATgBTAEQANQAxADIAMQAEABwAbQBpAG4AcwBrAC4AZQBwAGEAbQAuAGMAbwBtAAMAOABFAFYAQgBZAE0ASQBOAFMARAA1ADEAMgAxAC4AbQBpAG4AcwBrAC4AZQBwAGEAbQAuAGMAbwBtAAUAEABlAHAAYQBtAC4AYwBvAG0ABwAIANN9tO0P2s4BAAAAAA==\r\n
Action.c(32):     Date: Tue, 05 Nov 2013 10:15:18 GMT\r\n
Action.c(32):     Content-Length: 341\r\n
Action.c(32):     \r\n
Action.c(32): t=123447ms: 341-byte response body for "https://{HOST}/UrlRegistration/Register" (RelFrameId=1, Internal ID=22)
Action.c(32):     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">\r
Action.c(32):     \n
Action.c(32):     <HTML><HEAD><TITLE>Not Authorized</TITLE>\r\n
Action.c(32):     <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>\r\n
Action.c(32):     <BODY><h2>Not Authorized</h2>\r\n
Action.c(32):     <hr><p>HTTP Error 401. The requested resource requires user authentication.</p>\r\n
Action.c(32):     </BODY></HTML>\r\n
Action.c(32): t=123586ms: 287-byte response headers for "https://{HOST}/UrlRegistration/Register" (RelFrameId=1, Internal ID=22)
Action.c(32):     HTTP/1.1 404 Not Found\r\n
Action.c(32):     Cache-Control: private, s-maxage=0\r\n
Action.c(32):     Content-Type: text/html\r\n
Action.c(32):     Server: Microsoft-IIS/7.5\r\n
Action.c(32):     X-AspNetMvc-Version: 4.0\r\n
Action.c(32):     X-AspNet-Version: 4.0.30319\r\n
Action.c(32):     Persistent-Auth: true\r\n
Action.c(32):     X-UA-Compatible: IE=Edge, chrome=1\r\n
Action.c(32):     Date: Tue, 05 Nov 2013 10:15:18 GMT\r\n
Action.c(32):     Content-Length: 1245\r\n
Action.c(32):     \r\n
Action.c(32): t=123645ms: 1245-byte response body for "https://{HOST}/UrlRegistration/Register" (RelFrameId=1, Internal ID=22)
Action.c(32):     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/
Action.c(32):     xhtml1-strict.dtd">\r\n
Action.c(32):     <html xmlns="http://www.w3.org/1999/xhtml">\r\n
Action.c(32):     <head>\r\n
Action.c(32):     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>\r\n
Action.c(32):     <title>404 - File or directory not found.</title>\r\n
Action.c(32):     <style type="text/css">\r\n
...
Action.c(32):     </style>\r\n
Action.c(32):     </head>\r\n
Action.c(32):     <body>\r\n
Action.c(32):     <div id="header"><h1>Server Error</h1></div>\r\n
Action.c(32):     <div id="content">\r\n
Action.c(32):      <div class="content-container"><fieldset>\r\n
Action.c(32):       <h2>404 - File or directory not found.</h2>\r\n
Action.c(32):       <h3>The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.</h3>\r\n
Action.c(32):      </fieldset></div>\r\n
Action.c(32):     </div>\r\n
Action.c(32):     </body>\r\n
Action.c(32):     </html>\r\n
Action.c(32): Error -26627: HTTP Status-Code=404 (Not Found) for "https://{HOST}/UrlRegistration/Register"      [MsgId: MERR-26627]
Action.c(32): web_submit_data("Register") highest severity level was "ERROR", 2879 body bytes, 1101 header bytes    [MsgId: MMSG-26388]

时间戳是否会影响出现的错误?

1 个答案:

答案 0 :(得分:1)

经验法则:使用相同的用户ID记录两次。从一个记录会话更改为下一个记录会话的那些项目不是可选的。这是您的时间戳标签项目。在不同的用户ID下添加第三个记录,这将显示需要解决的特定于帐户的项目。