我有问题。 我在Jmeter中使用正则表达式提取器。我有两个正则表达式。
我可以从中获得价值。
Reference Name: as_fid_addtobasket
Regular Expression: <input type="hidden" name="as_fid" value="(.+?)" />
Template: $1$
但我无法从这一点获得价值。
> Reference Name: DynamicTempOrderProductGuid
>
> Regular Expression: <input data-val="true" data-val-required="The
> TempOrderProductGuid field is required."
> id="OrderProducts_1__TempOrderProductGuid"
> name="OrderProducts[1].TempOrderProductGuid" type="hidden"
> value="(.+?)" />
>
> Template: $1$
> >
这是我的结果。第二个没有得到价值。我错过了什么?
POST数据: OrderProducts.index = 1&安培; OrderProducts%5B1%5D.TempOrderProductGuid =%24%7BDynamicTempOrderProductGuid%7D&安培; OrderProducts%5B1%5D.Count = 1&安培; OrderProducts%5B1%5D.ReceiverModel.OrderReceiver.NameRec =测试+ AMA%C3%A7l %C4%B1D%C4%B1R + L%C3%BCtfen + dikkate +爱尔美%C4%B1n的%C4%B1z&安培; OrderProducts%5B1%5D.ReceiverModel.OrderReceiver.PhoneRec = 05352233285&安培; OrderProducts%5B1%5D.ReceiverModel。 OrderReceiver.OSSendingReason =安培; OrderProducts%5B1%5D.ReceiverModel.OrderReceiver.OSReceiverAddressType =安培; OrderProducts%5B1%5D.ReceiverModel.OrderReceiver.CompanyNameRec =安培; OrderProducts%5B1%5D.ReceiverModel.OrderReceiver.AddressLineRec =测试+ AMA% C3%A7l%C4%B1D%C4%B1R + L%C3%BCtfen + dikkate +爱尔美%C4%B1n的%C4%B1z&安培; OrderProducts%5B1%5D.ProductCode = se213&安培; OrderProducts%5B1%5D.TempOrderProductGuid =% 24%7Btokentoken%7D&安培; totalProducts = 1&安培; as_fid = efWZ0i4RGLmC2nBWk%2FA1
答案 0 :(得分:2)
我建议使用XPath Extractor,因为正则表达式很大程度上取决于布局,属性顺序,空格等,并且对于没有经验的用户来说,开发和测试可能是一个非常令人头痛的问题。特别是多线的。
用于从as_fid
输入中提取值的XPath表达式如下所示:
//input[@id='OrderProducts_1__TempOrderProductGuid']/@value
一些线索:
答案 1 :(得分:0)
答案 2 :(得分:0)
您可以将正则表达式更新为以下内容以获取有效的DynamicTempOrderProductGuid
Reference Name: DynamicTempOrderProductGuid
Regular Expression: name="(.+)"\stype="hidden"value="(.+)"
Template: $2$