Antwort: Re: [Webtest] clicklink and clickbutton-no new response ...

Werner Koenig webtest@lists.canoo.com
Tue, 20 Jul 2004 14:26:03 +0200


ok, I think you are right in some way:

In a very easy example (also with some javascript in it) it runs well -=20
clicklink and performing setinputfield and clickbutton

<html>
<head>
<TITLE>XX</TITLE>
<script type=3D"text/javascript" language=3D"Javascript1.1">=20

    function validate(form) {=20
    if (form.mytext.value=3D=3D'') {
        alert("fill it, please");
        return false;
    }
    else  {
      return true;=20
    }=20
   }=20
</script>
</head>
<body>
<form action=3D"./log4j.jsp" name=3D"myform"
        onsubmit=3D"return validate(document.myform);">
        <INPUT type=3D"text" name=3D"mytext" value=3D"" />
        <INPUT type=3D"submit" value=3D"mybutton" /></form>
<p><a href=3D"./menus.jsp">mylink</a></p>
</body>
</html>

We are using some very complex javacript-validations berfore submitting a=20
form (you know Struts?).
But I am sure, the javascript-code does not cancel the submit.
I tried the complex example with submit-cancelling input - and the submit=20
is not performed.

so I think:

easy submits and links run well, complex javascript cancels the request.

the two fixes are able to deal with complex javascript ....

am I right???


Freundliche Gr=FC=DFe

Werner K=F6nig





>May you have some javascript in the page? Calling link.click()=20
"simulates" a click on the link and triggers for instance=20
>the onclick javascript code which can cancel the navigation to the url=20
specified in the href. Else I know that httpunit=20
>handles targets quite bad. In all cases, if you can build a very small=20
sample script+html page illustrating the problem,=20
>I'm interested in (the smallest possible is the best, really with minimal =

html code).
>
>Marc.


Werner Koenig wrote:
> Hallo,
>=20
> when performing a click on a link or a button (see the following xml - I =


> don't think it is wrong !?) id does not work: no new request is coming=20
> from the server.
> In Server-debug-mode I did not see an incoming request.
>=20
> <clicklink stepid=3D"Detailinfo" label=3D"Dr">
>  or
> <setinputfield name=3D"nname" value=3D"aName" />
> <clickbutton stepid=3D"submit masuche"
>         label=3D" Suche starten ">
> <form name=3D"mitarbeitersuche" />
> </clickbutton>
>  I changed the code submitting the request in=20
com.canoo.webtest.steps.request.ClickButton.java:
>=20
> gotoTarget(...) {...
>   WebRequest req =3D form.getRequest((SubmitButton)button);
>   // original:=20
> setIntermediateResponse(context.getWebConversation().getCurrentPage());
> setIntermediateResponse(context.getWebConversation().getResponse(req));
> ...}
>=20
> and in ClickLink:
>  doExecute(...) {...
>                         prepareConversation(context);
>                                 theLink.click();
>                                 WebConversation wc =3D=20
> context.getWebConversation();
>                                 wc.sendRequest(theLink.getRequest());
>                                 WebResponse resp =3D wc.getCurrentPage();
> ...}
>=20
> before it was only         WebResponse resp =3D theLink.click();=20
>=20
> and now it works !?!?
>=20
> some ideas?
>=20
> Many thanks!
>=20
>=20
> Werner=20
> =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>=20

=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest