[Webtest] Another problem related to javascript
Marc Guillemot
webtest@lists.canoo.com
Tue, 05 Apr 2005 09:36:10 +0200
Hi Lisa,
you're right, this doesn't work currently in htmlunit... but neither in Mozilla for instance. This js code works only in IE.
If you have the possibility to fix the code, the best solution would be to make it cross browser and it would probably
work in htmlunit as well. Else, if you have plenty of such javascript, you can ask one of your developers to look at
htmlunit to improve it in this way. I think that it can be fixed without too much changes.
Marc.
Lisa Crispin wrote:
> Our web app uses javascript to prevent users from clicking certain
> buttons twice. When we first started using WebTest, we had to create a
> flag to disable that javascript so that our WebTest scripts could run.
> Now that WebTest is based on HtmlUnit and should support a lot more
> Javascript, I hoped the scripts would work with the javascript
> enabled (it would allow us to run some smoke tests against our staging
> and production environments to verify releases). However, it doesn't.
> Here is the javascript, form and button, followed by the WebTest syntax
> and the error message. Would anyone have advice for us?
>
>
> <script languange="javascript">
>
> var formCount0 = 0;
>
> function formOnSubmit0() {
>
> formCount0++;
>
> if (formCount0 > 1) { alert('This page has already been submitted!');
> event.returnValue = false; }
>
> else { event.returnValue = true; }
>
> }
>
> </script>
>
> <form method="post" action="login.jsp?submit=1&ts=65021"
> onSubmit="javascript: formOnSubmit0();">
>
> <input name="submitBtn" value="Submit" type="submit" class="formButton">
>
> </form>
>
>
>
> WebTest script:
>
> <clickbutton stepid="Submit the plan features"
> name="submitButton"/>
>
>
>
> Error:
>
> C:\java\eplan70\build.xml:1254: The following error occurred while
> executing this line:
> Test step clickbutton
> (C:\java\eplan70\src\web_test\modules\planEstStep1.xml:97:)
>
> named "Submit the plan features" failed with message "Step
> "clickbutton "Sub
> mit the plan features" (35/122): Script error executing at: click button"
>