Merci Marc, really, thanks a lot...

So, my problem is not solved, but I think you've found the cause.

The form is nested into another form !!!!!!!!!!!!!! And this form has
5 or 6 hidden input fields that appear in the Browser request, but
not in Webtest request. That's like that
<form name="parentform">
<input type="hidden" name="totohidden" value="ahahthisisyoursessionvalue">
   <form name="childform">
      <input type="submit" name="totonothidden">
   </form>
</form>

I think the normal browser submit the parent form as well as the selected form.
I don't think it is absolutely "w3c"

Then, as the solution is very close, I have the last question :

How can I submit the parent form (post method, with hidden fields, etc) and not the childform(get method, no knowledge of hidden fields) ? I tried a selectForm on the parent, it worked (form is well selected), but when I perform the clickButton method, I have :
*
DEBUG (com.canoo.webtest.steps.Step) - <<<< Successful Step: selectForm (52/54) DEBUG (com.canoo.webtest.reporting.StepExecutionListener) - fPreviousCurrentResponse: HtmlPage(http://.....)@31541880 DEBUG (com.canoo.webtest.reporting.StepExecutionListener) - fContext.getCurrentResponse(): HtmlPage(http://....)@31541880 DEBUG (com.canoo.webtest.reporting.StepExecutionListener) - isWorthSaving: false, false DEBUG (com.canoo.webtest.ant.TestStepSequence) - Executing step clickButton [EMAIL PROTECTED]
INFO (com.canoo.webtest.steps.Step) - >>>> Start Step: clickButton (53/54)
DEBUG (com.canoo.webtest.steps.request.AbstractIdOrLabelTarget) - Looking for html element with id: button_id DEBUG (com.canoo.webtest.steps.request.ClickButton) - It's an image input, that's ok DEBUG (com.canoo.webtest.steps.request.ClickButton) - Button passes test with label and name INFO (com.canoo.webtest.steps.request.ClickButton) - -> findTarget(by input): name=button_name value= DEBUG (com.gargoylesoftware.htmlunit.html.HtmlPage) - Page Encoding detected: windows-1252 DEBUG (com.gargoylesoftware.htmlunit.WebClient) - Get page for window named '', using WebRequestSettings[<url="http://...";, SubmitMethod[name=get], EncodingType[name=application/x-www-form-urlencoded], [], {Referer=http://...}, null>] DEBUG (com.gargoylesoftware.htmlunit.WebClient) - Load response for http://... DEBUG (org.apache.commons.httpclient.params.DefaultHttpParams) - Set parameter http.authentication.credential-provider = [EMAIL PROTECTED] DEBUG (org.apache.commons.httpclient.methods.GetMethod) - enter GetMethod(String) DEBUG (org.apache.commons.httpclient.params.DefaultHttpParams) - Set parameter http.method.retry-handler = [EMAIL PROTECTED] DEBUG (org.apache.commons.httpclient.HttpClient) - enter HttpClient.executeMethod(HostConfiguration,HttpMethod) DEBUG (org.apache.commons.httpclient.HttpClient) - enter HttpClient.executeMethod(HostConfiguration,HttpMethod,HttpState) DEBUG (org.apache.commons.httpclient.MultiThreadedHttpConnectionManager) - enter HttpConnectionManager.getConnectionWithTimeout(HostConfiguration, long) DEBUG (org.apache.commons.httpclient.MultiThreadedHttpConnectionManager) - HttpConnectionManager.getConnection: config = HostConfiguration[host=http://...], timeout = 0 DEBUG (org.apache.commons.httpclient.MultiThreadedHttpConnectionManager) - enter HttpConnectionManager.ConnectionPool.getHostPool(HostConfiguration) DEBUG (org.apache.commons.httpclient.MultiThreadedHttpConnectionManager) - enter HttpConnectionManager.ConnectionPool.getHostPool(HostConfiguration) DEBUG (org.apache.commons.httpclient.MultiThreadedHttpConnectionManager) - Getting free connection, hostConfig=HostConfiguration[host=http://...] DEBUG (org.apache.commons.httpclient.HttpMethodDirector) - Attempt number 1 to process request DEBUG (org.apache.commons.httpclient.HttpConnection) - enter HttpConnection.open() DEBUG (org.apache.commons.httpclient.HttpConnection) - Open connection to ... DEBUG (org.apache.commons.httpclient.HttpMethodBase) - enter HttpMethodBase.execute(HttpState, HttpConnection) DEBUG (org.apache.commons.httpclient.HttpMethodBase) - enter HttpMethodBase.writeRequest(HttpState, HttpConnection) DEBUG (org.apache.commons.httpclient.HttpMethodBase) - enter HttpMethodBase.writeRequestLine(HttpState, HttpConnection) DEBUG (org.apache.commons.httpclient.HttpMethodBase) - enter HttpMethodBase.generateRequestLine(HttpConnection, String, String, String, String) DEBUG (httpclient.wire.header) - >> "GET http://...?nothiddenfield=toto HTTP/1.1[\r][\n]"


*That is not so weird, I think, since the button may reference its parent form, does it ?

Do you see a workaround ? I'm too close to the goal, then I won't surrender !!!!!!!!!

Thanks for reading

Marc Guillemot a écrit :
Salut Florent,

to understand what happens, you can try to look at the post details
(url, fields and headers) both in WebTest and in a normal browser for
your 9. step.

...
Is there a way in Webtest to only trigger the Javascript of abutton
without sumitting the form

you can modify the html DOM to add inject for instance some onsubmit
that returns false in your page, but I don't see what you would achieve
with that.

(I think the navigation error come from the
fact the POST method is not Ajax called ) ?

???

Marc.


--
Pingwy
27, rue des arènes
49100 Angers

Reply via email to