簡體   English   中英

jmeter獲取_VIEWSTATE和__EVENTVALIDATION參數時出現問題

[英]jmeter Problems getting the _VIEWSTATE and __EVENTVALIDATION parameters

我在獲取__VIEWSTATE和__EVENTVALIDATION參數時遇到一些問題。 我正在使用后處理器正則表達式提取器,並將其配置如下:

參考名稱:aspViewstate

正則表達式:name =“ __ VIEWSTATE” id =“ __ VIEWSTATE” value =“(。+?)”

模板:$ 1 $

比賽編號(0為隨機):1

默認值:ERROR_VIEWSTATE

參考名稱:aspEventValidation

正則表達式:name =“ __ EVENTVALIDATION” id =“ __ EVENTVALIDATION” value =“(。+?)”

模板:$ 1 $

比賽編號(0為隨機):1

默認值:ERROR_EventValidation

然后,Im在http請求中分別替換$ {aspViewstate}和$ {aspEventValidation}的每個參數的值。

我將正則表達式提取器放在GET請求之下,然后放在POST請求之前。

我包括一個調試采樣器,我得到了“錯誤結果”:

aspEventValidation=ERROR_EventValidation
aspViewstate=ERROR_VIEWSTATE

請任何人能幫助我了解我所缺少的....

更新:我正在使用CSS / JQuery提取器獲取__VIEWSTATE,如下所示,並且正在工作:

CSS/JQuery Extractor Implementation:JSOUP

Reference Name: aspViewstate

CSS/JQuery Expression: input[id=__VIEWSTATE]

Attribute: value

Template: $1$

Match No. (0 for Random): 0

Default value: ERROR

但是對於__EVENTVALIDATION無效,並且Im使用相同的正弦值:

CSS/JQuery Extractor Implementation:JSOUP

Reference Name: aspEventValidation

CSS/JQuery Expression: input[id=__EVENTVALIDATION]

Attribute: value

Template: $1$

Match No. (0 for Random): 0

Default value: ERROR

我不知道有什么問題...

關於VIEWSTATE我已經獲取了值,但是系統正在向我發送以下錯誤,就像沒有發送VIEWSTATE ...

錯誤:

    <code><pre>

[FormatException: The input is not a valid Base64 string that contains a         character that is not Base 64, more than two filler characters or an invalid   character among the padding characters . ]
   System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength) +14115992
   System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength) +162
   System.Convert.FromBase64String(String s) +56
   System.Web.UI.ObjectStateFormatter.Deserialize(String inputString, Purpose purpose) +102
   System.Web.UI.Util.DeserializeWithAssert(IStateFormatter2 formatter, String serializedState, Purpose purpose) +67
  System.Web.UI.HiddenFieldPageStatePersister.Load() +200

[ViewStateException: View state invalid 
    Client IP: 
    Port: 
    Referer: http://Art/WebLogiPortal/wfmLoginD.aspx?ReturnUrl=%2fArt%2fWebLogiPortal%2fwfmDefault.aspx
    Path: /Art/WebLogiPortal/wfmLoginD.aspx
    User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
    ViewState: ${aspViewstate}]

    [HttpException (0x80004005): The state information is invalid for this page and might be corrupted.]
    System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +157
    System.Web.UI.HiddenFieldPageStatePersister.Load() +12060517
    System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +12315765
    System.Web.UI.Page.LoadAllState() +51
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +12308619
    System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +12308137
    System.Web.UI.Page.ProcessRequest() +119
    System.Web.UI.Page.ProcessRequest(HttpContext context) +99
     System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +913
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp;        completedSynchronously) +165
    </pre></code>

我添加了一個Debug Post處理器,我意識到發送到服務器的值在日后是變量的字符(即$ {viewstate}),而不是值的字符,甚至不是默認值(錯誤)。 可能會發生什么?

這是“調試后”處理器的響應日期:

HTTPSampler.response_timeout=
HTTPSampler.use_keepalive=true
    HTTPsampler.Arguments=wucLoginPortal_ScriptManager1_HiddenField=&__EVENTTARGET=&__EVENTARGUMENT=&__LASTFOCUS=&__VIEWSTATE=${aspViewstate}&__VIEWSTATEGENERATOR=${viewstateGenerator}&__EVENTVALIDATION=${aspEventValidation}&wucLoginPortal$__LBLHDN__=&wucLoginPortal$txtLoginAD=user1&wucLoginPortal$txtPasswordAD=user1&wucLoginPortal$txtDominioAD=art.com&wucLoginPortal$btnAceptarAD=Aceptar
TestElement.enabled=true
TestElement.gui_class=org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui
TestElement.name=4 /Art/WebLogiPortal/wfmLoginD.aspx?ReturnUrl=%2fArt%2fWebLogiPortal%2fwfmDefault.aspx
TestElement.test_class=org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy
TestPlan.comments=Detected the start of a redirect chain

我不建議使用正則表達式提取器來獲取viewstate和eventvalidation值,以防更改屬性位置,或者在多行上或有多余的空間可能導致您的正則表達式失敗。

JMeter提供了2個測試元素,旨在從HTML頁面提取值,它們是:

XPath定位器示例如下所示:

//input[@id='__VIEWSTATE']/@value

CSS選擇器示例將是

input[id=__VIEWSTATE]

在“屬性”輸入中指定value

有關更多詳細信息和建議,請參閱《 使用JMeter進行ASP.NET登錄測試》指南。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM