You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Noel O'Brien <no...@newbay.com> on 2009/08/24 10:56:52 UTC

Executing JavaScript

Hi, 

I know JMeter doesn't execute any JS returned by web pages; I'm just wondering if it's technically possibly to execute it (e.g. in a Post Processor) using the Rhino engine in Java or some other mechanism? 

The reason I'm asking is because I'm trying to access websites which rely heavily on JS, particularly for login. Not being able to execute JS means I just get presented with a login page each time I try access other page. 

Regards, 
Noel 

Re: Executing JavaScript

Posted by kirk <ki...@kodewerk.com>.
Noel O'Brien wrote:
> Hi, 
>
> I know JMeter doesn't execute any JS returned by web pages; I'm just wondering if it's technically possibly to execute it (e.g. in a Post Processor) using the Rhino engine in Java or some other mechanism? 
>
> The reason I'm asking is because I'm trying to access websites which rely heavily on JS, particularly for login. Not being able to execute JS means I just get presented with a login page each time I try access other page. 
>
> Regards, 
> Noel 
>
>   
In theory this is possible but in practice it isn't. At least not 
without a lot of work. First, Rhino only has a single name space and 
lacks a DOM. Any JavaScript that is called to manipulate the page (which 
includes just about all of it) will fail. In the past I've found it much 
more practical to use an http sampler to make the request and a 
beanshell post processor to deal with the results. It works but it's a 
bit messy and it doesn't scale (as a development practice).

Kind regards,
Kirk

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


Re: Executing JavaScript

Posted by Noel O'Brien <no...@newbay.com>.
Thanks for your input Sebb; I'll investigate the use of the proxy for my situation as it sounds like much less work than executing JS :) 

Regards, 
Noel 

----- "sebb" <se...@gmail.com> wrote: 
> On 24/08/2009, Noel O'Brien <no...@newbay.com> wrote: 
> > Hi, 
> > 
> > I know JMeter doesn't execute any JS returned by web pages; I'm just wondering if it's technically possibly to execute it (e.g. in a Post Processor) using the Rhino engine in Java or some other mechanism? 
> 
> In theory, it's possible, however it needs more than just the Rhino 
> engine. The page has to be parsed into the DOM and the script(s) 
> extracted, then the appropriate methods called. 
> 
> The resulting page then has to be re-examined to decide what to do, 
> possibly calling more Javascript. 
> 
> > The reason I'm asking is because I'm trying to access websites which rely heavily on JS, particularly for login. Not being able to execute JS means I just get presented with a login page each time I try access other page. 
> 
> Use the Proxy to record the login, and then work out how to extract 
> any extra data that is added to the page by the scripting. 
> 
> > Regards, 
> > 
> > Noel 
> > 
> 
> --------------------------------------------------------------------- 
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org 
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org 
> 
> 

Re: Executing JavaScript

Posted by sebb <se...@gmail.com>.
On 24/08/2009, Noel O'Brien <no...@newbay.com> wrote:
> Hi,
>
>  I know JMeter doesn't execute any JS returned by web pages; I'm just wondering if it's technically possibly to execute it (e.g. in a Post Processor) using the Rhino engine in Java or some other mechanism?

In theory, it's possible, however it needs more than just the Rhino
engine. The page has to be parsed into the DOM and the script(s)
extracted, then the appropriate methods called.

The resulting page then has to be re-examined to decide what to do,
possibly calling more Javascript.

>  The reason I'm asking is because I'm trying to access websites which rely heavily on JS, particularly for login. Not being able to execute JS means I just get presented with a login page each time I try access other page.

Use the Proxy to record the login, and then work out how to extract
any extra data that is added to the page by the scripting.

>  Regards,
>
> Noel
>

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