LoadRunner无法捕获Worldpay支付的integrationID问题求助
Let's break down your issue and fix it step by step:
Core Problems Identified
- Invalid Regular Expression: Your regex has excessive, unnecessary escape characters (
\\) and spaces that break the pattern matching. - Incorrect Correlation Placement: The
web_reg_save_param_regexpfunction is positioned before the wrong request—you're trying to capture a value from a response that doesn't contain the target attribute, leading to the-35049no-match error. - Bad Request (400): Since the parameter
c_integrationIDisn't captured, LoadRunner sends the raw placeholder{c_integrationID}in the request, which Worldpay rejects as invalid.
Step-by-Step Fixes
1. Clean Up the Regular Expression
Replace your messy regex with a simplified, functional pattern that matches the target attribute pair. The \\s+ matches any whitespace (spaces, newlines) between the two attributes:
web_reg_save_param_regexp( "ParamName=c_integrationID", "RegExp=data-iframe-integration-id=\"(.*?)\"\\s+data-iframe-origin", SEARCH_FILTERS, "Scope=Body", "IgnoreRedirections=No", LAST);
2. Move Correlation to the Correct Request
The data-iframe-integration-id attribute lives in the response from the worldpay.htm page (your Referer URL), not the corporate iframe request you're currently targeting. Reorder your code to place the correlation function right before that parent page request:
// Correlation goes BEFORE the request that returns the target attribute /*Correlation comment - Do not change! Original value='1560785768009' Name ='c_integrationID' Type ='Manual'*/ web_reg_save_param_regexp( "ParamName=c_integrationID", "RegExp=data-iframe-integration-id=\"(.*?)\"\\s+data-iframe-origin", SEARCH_FILTERS, "Scope=Body", "IgnoreRedirections=No", LAST); // Request the page that contains the iframe with integrationID web_url("worldpay.htm", "URL=https://uk-cr-sapvpt1.dysonsap.sap/sap(bD1lbiZjPTIwMA==)/bc/bsp/sap/zworldpay/worldpay.htm?wp_url=https%3a%2f%2fpayments-test.worldpay.com%2fapp%2fhpp%2fintegration%2fwpg%2fcorporate%3fOrderKey%3dDYSONUSDMOTO%255E{c_orderKey}%26amp%3bTicket%3d{c_ticket}%26language%3den%26preferredPaymentMethod%3d{preferredPaymentMethod}", "Resource=0", "RecContentType=text/html", "Snapshot=txxx.inf", "Mode=HTTP", LAST); // Now use the captured parameter in the iframe request web_url("corporate", "URL=https://payments-test.worldpay.com/app/hpp-iframe/integration/wpg/corporate?OrderKey=DYSONUSDMOTO^{c_orderKey}&Ticket={c_ticket}&language=en&preferredPaymentMethod={preferredPaymentMethod}&iframeIntegrationId={c_integrationID}&iframeHelperURL=https%3A%2F%2Fuk-cr-ap1vpt1.dysonsap.sap%3A1443%2Fsap%2Fbc%2Fbsp%2Fsap%2Fzworldpay%2Fhelper.htm", "Resource=0", "RecContentType=text/html", "Referer=https://uk-cr-sapvpt1.dysonsap.sap/sap(bD1lbiZjPTIwMA==)/bc/bsp/sap/zworldpay/worldpay.htm?wp_url=https%3a%2f%2fpayments-test.worldpay.com%2fapp%2fhpp%2fintegration%2fwpg%2fcorporate%3fOrderKey%3dDYSONUSDMOTO%255E{c_orderKey}%26amp%3bTicket%3d{c_ticket}%26language%3den%26preferredPaymentMethod%3d{preferredPaymentMethod}", "Snapshot=t649.inf", "Mode=HTTP", LAST);
3. Verify the Response Content
- Use LoadRunner's Snapshot tool to inspect the response body of the
worldpay.htmrequest. Confirm thedata-iframe-integration-id="..."attribute exists in the HTML. - Enable Extended Logging (check "Parameter Substitution" and "Data returned by server") to debug:
- See if the parameter is being populated correctly
- Verify the regex matches the response content
4. Edge Case Check
If the integrationID is dynamically generated via JavaScript (not present in the raw HTTP response), switch to LoadRunner's GUI mode or analyze the JS code to find the API that fetches the ID directly—then correlate from that API response instead.
内容的提问来源于stack exchange,提问作者Jen




