HomeSUPPORT QUESTIONS

Need help with StresStimulus? Start here.

Extracting a value from a URL the browser has been redirected to - how to do?: Messages in this topic - RSS

Charles Durrant
Charles Durrant
Posts: 8


9/26/2012
Charles Durrant
Charles Durrant
Posts: 8
Hi,
Does anyone know how to extract a URL param from a URL a brower has been redirected to?
 
e.g.
1) Browse to test.php?createform=1
2) Site redirects to newpage.php?id=1
 
the 'id' need to subsequently be used in each request but I can't see how to extract the id from the redirected URL to use in subsequent submissions.
 
Charlie...
 
0 link
Vadim @StresStimulus
Vadim @StresStimulus
Administrator
Posts: 583


9/27/2012
Vadim @StresStimulus
Vadim @StresStimulus
Administrator
Posts: 583
Charlie,
Your recorded test case among other should include 2 requests:
Request 1 – to URL test.php?createform=1;
Response 1 should have a header "location" with the  value newpage.php?id=1
Request 2 – to URL newpage.php?id=1
To solve your task try to create 2extractors and 2+ parameterization rules.
1. Select request 1 and create a Header extractor from the header "location". Select "location" from the drop-down (not shown on the screenshot below). Let's call it myRedirectURL.

 2.  From the same request 1 create a Test Delimited extractor; let's call it myRedirectID. In the "ends with" text box enter the "new line" value "\n" (assuming that the location header is separated from the subsequent header by the "new line").



3. To implement redirect, select request 2 and use the extractor myRedirectURL to parameterize the Header {PATH}

4. Use extractor myRedirectID to parameterize any other subsequent requests in your test case where you need to use the ID

Does it make sense?
Cheers,
-Vadim
0 link
Charles Durrant
Charles Durrant
Posts: 8


9/27/2012
Charles Durrant
Charles Durrant
Posts: 8
Vadim,

All makes sense - thank you - I had looked at this but....there is one problem the \n or in my case \r doesn't seem to work. I can search for text on the next line i.e. Set-Cookie but not \r or \n - nothing comes back. If I use Set-Cookie as the end search the CRLF will be included and if the header order changes I'm stuffed.

Here is my response with the CRLFs in view:

Here is the response text
<START>
HTTP/1.1 302 Moved Temporarily Content-Type: text/html; charset=UTF-8
Location: form2.php?table_name=forms&form_id=19281
Set-Cookie: identity_se_id=224FD904-DCA6-4270-96CC-C6A84BDFBB41; httponly Date: Wed, 26 Sep 2012 15:19:33 GMT
Content-Length: 176
<head><title>Document Moved</title></head> <body><h1>Object Moved</h1>This document may be found <a HREF="form2.php?table_name=forms&amp;form_id=19281">here</a></body>
<END>

Is there something special to do when searching for \r or \n?

Charlie
0 link
Max @StresStimulus
Max @StresStimulus
Administrator
Posts: 101


9/27/2012
Max @StresStimulus
Max @StresStimulus
Administrator
Posts: 101
Charlie,
It may be simpler to use a Regular Expression Extractor. Try the following regular expression:

form_id=(\d+)

To test if extractor works, click on "Verify Extractor" Button.
0 link
Charles Durrant
Charles Durrant
Posts: 8


10/1/2012
Charles Durrant
Charles Durrant
Posts: 8
Max,

Thanks for the hint but unfortunately there seems to be a bug in the software with regular expressions. Screenshot attached - can't attach through the company firewall?!? with the ajax image uploder...
 
The error is:
   The "Reg Expr" field can't be empty
When I click the verify extractor button - Version 2.0.4635
Charlie
 
0 link
Max @StresStimulus
Max @StresStimulus
Administrator
Posts: 101


10/1/2012
Max @StresStimulus
Max @StresStimulus
Administrator
Posts: 101
Charlie,

Thanks for letting me know about the bug. We just fixed it and released a new build. Please download the new version from our website.
0 link
Charles Durrant
Charles Durrant
Posts: 8


10/1/2012
Charles Durrant
Charles Durrant
Posts: 8
Mark, the software just notified me and I thought I'd look for a reply to this topic and low and behold!
p.s. velocity engine could be an easy way to add c# scripting via a known(ish) format to enabled dynamic data sources re my other post for gnerating unique IDs. Just a thought and thanks for the fix.
Charlie
 
0 link
Max @StresStimulus
Max @StresStimulus
Administrator
Posts: 101


10/1/2012
Max @StresStimulus
Max @StresStimulus
Administrator
Posts: 101
Charlie,
Thanks for the hint.
Also, I wanted to let you know that you are entitled to receive a free StresStimulus Pro 500 VU weekly pass for reporting the bug. To claim your activation key, please send an e-mail to support@stimulustechnology.com within 30 days. 
0 link
Charles Durrant
Charles Durrant
Posts: 8


10/1/2012
Charles Durrant
Charles Durrant
Posts: 8
Mark,
 
Most kind, we're buying the software but the time it takes to actually purchase something in a big company is an age and it will certianly bridge the gap.
 
Thanks again,
 
Charlie
0 link






Copyright © 2024 Stimulus Technology