[Webtest] Javascript alert onLoad

Thomas Colin de Verdière webtest@lists.canoo.com
Wed, 14 Jun 2006 16:16:33 +0200


Basically i have a page that onLoad (body onload event)
display an alert window depending on some variables.
And i don't succeed to test this with the expectDialog step.

When i don't put the expectDailog step i have :
[clickButton]  WARN 
(com.gargoylesoftware.htmlunit.javascript.host.Window) - 
window.alert("ds'ds<ds"ds\") no alert handler installed
when i put the expectDialog step i have :
Test failed.
Test step clickButton 
(D:\WebTest\webtests\modules\verifieMessageConstanteEchappement.xml:4: 
)  named "Click the Connect button" failed with message 
"Step[clickButton "Click the Connect button" (8/25)]: Script error 
loading page executing webtest at: clickButton Wrapped 
com.gargoylesoftware.htmlunit.ScriptException: Wrapped 
com.canoo.webtest.engine.StepFailedException: Expected dialogs but none 
found!, Step: ExpectDialog at 
D:\WebTest\webtests\modules\verifieMessageConstanteEchappement.xml:1:  
with (saveProperty="messageDialog", description="<unknown>", 
dialogType="alert", stepType="expectDialog")
...

As you can see i am testing the escaping of the value ds'ds<ds"ds\ i 
could test directly the presence of this string in the page but it is 
more simple to verify that the dialog display well.
Do i have a possibility to do this,

Thanks,
Thomas