次のような長い URL を短い 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]
タイムスタンプはエラーの表示に影響しますか?