[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jmeter-user
Subject:    Re: how to parse JavaScript Link?
From:       sebb <sebbaz () gmail ! com>
Date:       2008-02-26 12:19:51
Message-ID: 25aac9fc0802260419t3d37a562x4f8a65624cda61e5 () mail ! gmail ! com
[Download RAW message or body]

On 26/02/2008, Tom Fernandes <anyaddress@gmx.net> wrote:
> Hi,
> 
> 
> On Tuesday, 26. February 2008, sebb wrote:
> > On 25/02/2008, Tom Fernandes <anyaddress@gmx.net> wrote:
> > > Hello,
> > > 
> > > How can I call the following Link:
> > > 
> > > <a class="button"
> > > 
> > > href="javascript:openDetailsWindow('details_car.php?affiliate=bm&amp;prov
> > > ider=drivefti&amp;car_id=136106430&amp;IMAGE_URL=http%3A%2F%2Fwww.contact.
> > > fti.de%2Fibe%2Fimg%2Fsample_cars%2Fmcc_smart.gif&amp;country_code=DE&amp;q
> > > uoteIdentifier=0fb6f94d2c8a91d33d81e30eba664839&amp;code=DEU65&amp;pcity=C
> > > GN&amp;rcode=A1&amp;pdate=28022008&amp;quoteIdentifier=', 'Details',
> > > 'scrollbars=yes,width=618,height=435')">i</a>
> > > 
> > > 
> > > I tried the RegularExpression Extractor but it won't work because of
> > > the "&amp" and the "%XY" notations.
> > 
> > What RE did you actually try?
> 
> 
> 
> Thread group
> > 
> > 
> ...
> > 
> > -- HTTP Request (which gets the page containing the JS link)
> > > 
> > > -- Regular Expression Extractor:
> > Response Field to check: Body
> > Reference Name: CAR_DETAILS_URL
> > Regular Expression: openDetailsWindow\(\'(.*)\', \'Details

BTW, there is no need to escape the ' (single-quotes)

> > Template: $1$
> > Match No.: 1
> > Default: NOT FOUND
> > 
> > -- HTTP Request (get /cars/bm/${CAR_DETAILS_URL})
> > 
> ...
> 
> Regular Expression:
> 
> 
> > 
> > In what way does it not work?
> 
> 
> The URL in the second HTTP Request will look like:
> 
> http://1.2.3.4/cars/bm/details_car.php?affiliate=bm&amp;provider=drivefti&amp;car_id \
> =136420315&amp;IMAGE_URL=http%3A%2F%2Fwww.contact.fti.de%2Fibe%2Fimg%2Fsample_cars%2 \
> Fmcc_smart.gif&amp;country_code=DE&amp;quoteIdentifier=3eddbddacbcca3f72502c8adf008b \
> 524&amp;code=DEU65&amp;pcity=CGN&amp;rcode=A1&amp;pdate=28022008&amp;quoteIdentifier=
>  

So the RE extractor *does* work.

> The Problem is that "&amp" is supposed to be "&", "%3A" is supposed to be
> a ":", "%2F" is supposed to be a "/".

... which is not a problem with the RE extractor ...

> As far as I understand this URL is URL-encoded so that JS doesn't interpret
> some characters. Calling this page directly through a HTTP Request won't work
> though. If I substitute the "&amp" and the "%NN" notations with "&",  ":"
> and "/", the URL works.
> 
> How can I do this automatically?
> 

This is not possible automatically.

However you can process the extracted string with one of the JMeter functions.

I've made a start on documenting some workrounds at:

http://wiki.apache.org/jakarta-jmeter/EscapedURLs

> cheers,
> 
> 
> Tom
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic