I just spent all day today on webtest trying to fix this issue and decided
running this by Marc and other webtest experts might result in a quicker
solution.

I just downloaded the latest build of webtest today(Mar 19'09) (Release
class = development, build number = R_1762)
Our app uses dojo components like buttons,dialogs and some ajax calls. I
setup a simple test to click a button on the home page as shown  :

<button dojoType="dijit.form.Button" id="myButton"
onClick="window.location='viewmyPage.do'"><b>View Page</b></button>

This runs fine when tested manually on firefox as well as IE.

My webtest.xml contains:
<webtest name="mytest">
<invoke url="http://localhost:8080/<app>/viewHome.do"/>
-
<clickButton htmlId="myButton"/>
-
<verify../>
</webtest>

When i run webtest the steps before the clickButton get executed. Some of
these steps call javascript and they work as well so I know javascript is
enabled. However execution fails at the clickButton step with the following
error in the report:

JavaScript error loading page http://localhost:8080/<app>/viewHome.do:
Wrapped com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot
read property "controlButton" from undefined (http://localhost:8080/
<app>/js/dojoroot/dojo/dojo.js#20)

The console shows the following errors and warnings:

[invoke]  WARN (com.gargoylesoftware.htmlunit.html.HtmlPage) - Obsolete
content type encountered: 'text/javascript'.
[clickButton]  INFO (com.canoo.webtest.steps.Step) - >>>> Start Step:
clickButton (11/18)
[clickButton]  INFO (com.canoo.webtest.steps.request.ClickButton) - ->
findTarget(by button): name= value=
[clickButton] ERROR
(com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine)
- runtimeError: message=[document.execCommand(): invalid command
'BackgroundImageCache']
sourceName=[http://localhost:8080/<app>/js/dojoroot/dojo/dojo.js]
line=[20] lineSource=[null] lineOffset=[0]
[clickButton]  INFO (com.canoo.webtest.engine.WebClientContext) - Content of
window changed to http://localhost:8080/<app>/viewMyPage.do (text/html)
[clickButton]  INFO (com.canoo.webtest.engine.WebClientContext) - Content of
current window changed, it will become current response
[clickButton]  INFO (com.canoo.webtest.engine.WebClientContext) - Current
form set to none
[clickButton]  INFO (com.canoo.webtest.engine.WebClientContext) - Current
response now: http://localhost:8080/<app>/viewMyPage.do
 INFO (com.canoo.webtest.engine.WebClientContext) - Responses restored
 INFO (com.canoo.webtest.ant.WebtestTask) - Finished executing webtest
"mytest"....

Some of the things i tried with no success after searching through your
archives were:
1.) enableJavaScript - enabled and disabled
2.) registerModulePath -
<script type="text/javascript">
dojo.registerModulePath("dijit", "http://localhost:8080/
<app>/js/dojoroot/dijit");
dojo.registerModulePath("dojox", "http://localhost:8080/
<app>/js/dojoroot/dojox");
</script>
I tried this with different path combinations. Full path, "../dijit",
"js/dojoroot/dijit" etc.
3.) <clickButton label="View Page"/>
4.) in config set browser to Firefox3

I have to demo this in a few days at our company as a potential testing tool
and really prefer webtest because of the features it offers. Hopefully, iam
just missing something basic and someone can point me in the right
direction.

thanks
ashwin.

Reply via email to