2013-01-17 25 views
1

我手動關聯的常用方法是設置左邊界和右邊界,因爲我在初始網頁的html中找到它。 然而,在LoadRunner中使用擴展日誌記錄我看到JSESSIONID從服務器這種方式返回:LoadRunner保存由服務器返回的JSESSIONID不在html中

Action.c(4): Redirecting "http://xxx/xxx/" (redirection depth is 1)  [MsgId: MMSG-26694] 

Action.c(4): To location "http://xxx/xxx/xxx/xxx"  [MsgId: MMSG-26693] 

Action.c(4): t=3707ms: 384-byte response headers for "http://xxx/xxx/xxx/xxx" (RelFrameId=1,  Internal ID=3) 

Action.c(4):  HTTP/1.1 302 Moved Temporarily\r\n 

Action.c(4):  Server: Apache-Coyote/1.1\r\n 

Action.c(4):  Set-Cookie: JSESSIONID=b6A10tdvDpwexLDVS4VKGHEX; Path=/xxx\r\n 

Action.c(4):  Date: Thu, 17 Jan 2013 12:04:38 GMT\r\n 

Action.c(4):  Expires: Thu, 01 Jan 1970 00:00:00 GMT\r\n 

Action.c(4):  Pragma: no-cache\r\n 

Action.c(4):  Cache-Control: no-cache, no-store\r\n 

Action.c(4):  Location: http://xxx/xxx/xxx/xxx;jsessionid=b6A10td 

Action.c(4):  vDpwexLDVS4VKGHEX?0\r\n 

Action.c(4):  Content-Length: 0\r\n 

Action.c(4):  \r\n 

Action.c(4): Redirecting 

如何抓住這個價值?因爲它不在從服務器返回的HTML中?

BR 馬格努斯

+0

BTW:看來,LR(11.0)自動處理的這對我來說,但我想在控制我腳本... –

回答

2

好,解決了它使用的是:

web_reg_save_param("JSessionID", "LB=JSESSIONID=", "RB=;", LAST); 
+1

'web_reg_save_param()'也在HTTP標頭中查找。這就是它工作的原因。但是,LR會自動處理,所以可能沒有必要。如果你所要做的只是稍後通過刪除/不發送cookie來強制註銷,則可以使用'web_cleanup_cookies()'。 – AngerClown