logo       

Re: Workaround for verifyAlert and onload() event handler?: msg#00020

web.selenium.user

Subject: Re: Workaround for verifyAlert and onload() event handler?

Altin, Mattias wrote:

In the Selenium reference under verifyAlert I found this: "NOTE:
Selenium does NOT support javascript alerts that are generated in a
page's onload() event handler. In this case a visible dialog WILL be
generated and Selenium will hang until you manually click OK."

Does anyone know of a workaround for this?

I haven't tried this myself, but I seem to recall someone getting around this by delaying the alert using window.setTimeout(), ie. instead of

<body onload='alert("blah")'>
...

you'd do something like

<body onload='window.setTimeout("handleOnload()",0)'>
<script>
function handleOnload() {
alert("blah");
}
</script>
...

--
cheers, MikeW http://www.dogbiscuit.org/mdub/


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise