[Webtest] Post a request without content

Petter Mhln webtest@lists.canoo.com
Tue, 18 Apr 2006 16:03:38 +0200


This is how I do it:

<emulateSetHiddenInputField description="user name" name="email"
value="${login.email}" />
<emulateSetHiddenInputField description="password" name="password"
value="${login.password}" />
<groovy description="submit login form via javascript">
  step.context.currentResponse.getFormByName('loginForm').submit()
</groovy>

HTH,

Petter 

> -----Original Message-----
> From: webtest-admin@lists.canoo.com 
> [mailto:webtest-admin@lists.canoo.com] On Behalf Of Philippe Schoch
> Sent: Tuesday, April 18, 2006 3:59 PM
> To: webtest@lists.canoo.com
> Subject: [Webtest] Post a request without content
> 
> Hi,
> 
> I have the problem to address a lot of anonymous links in a 
> (jsf-)page 
> that execute some javascript-code (at 'onClick').
> To address via XPath is not suitable and prone to fail on 
> changes made 
> to the page.
> One try was to execute the js-code directly from webtest with 
> 'scriptStep'. Aside the problem I encountered (see email 'scriptStep: 
> JavaScriptEngine not found') the js-code is not run in the 
> scope of the 
> page (what I was afraid of. But I thought I can get over that when my 
> Classloader-problem has been solved).
> So another try was to set the hidden field via 
> 'emulateSetHiddenInputField' and to submit the form. That's what the 
> onClick-js-code is doing.
> To submit the form I only see the solution with <invoke 
> method="POST">. 
> But I have to add a contentfile which content seems to be 
> very complex. 
> Or can I enforce a submit()?
> Does somebody have another idea or is Webtest not made to deal 
> efficiently with such a problem?
> 
> Thanks for help,
> 
> Philippe
>