Re: onLoad fires before ready()

sandy oberoi <[email protected]>
Newsgroups gmane.comp.web.canoo.webtest
Message-ID <[email protected]>
I just tried running the test on latest build 1810 and still getting the
same error.

Below is the code i tried

HTML:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="js/jquery-1.2.6.js"></script>
<script type="text/javascript">
window.addEventListener("load", executeOnLoad, false);
function executeOnLoad(){
//alert("on load event");
document.getElementById("testContent").innerHTML += " on load event ";
}
 jQuery(function() {
//alert("read function");
document.getElementById("testContent").innerHTML += " on ready event ";
});
</script>
<title>Test Page</title>
</head>
<body>
<div id="content">
<p id="testContent">This is a test page</p>
</div>
</body>
</html>


WEBTEST:

public class JSEventWebtestTest extends WebtestCase
{
void testJSEvent()
{
webtest("Test for onload event")
{
config(easyajax: "true", browser: "FF3") {
option name: "ThrowExceptionOnScriptError", value: "true"
header name: "User-Agent", value: "iPhone"
}
invoke url: "http://localhost:8080/test", description: "Go to the test page"
groovy {
println step.context.currentResponse.asXml();
}
}
}
}


If user agent is removed the events will fire appropriately. This used to
work in the old build. I am not sure what has changed or am i doing
something wrong.

~Sandy

On Tue, Nov 23, 2010 at 11:06 PM, sandy oberoi <[email protected]>wrote:

> not sure  ... try checking if ur facing this issue as well with read() and
> onload
>
> ---------- Forwarded message ----------
> From: Josep García <[email protected]>
> Date: Tue, Nov 23, 2010 at 12:47 AM
> Subject: Re: [Webtest] onLoad fires before ready()
> To: [email protected], sandy oberoi <[email protected]>
>
>
> We have also experienced problems with htmlunit 2.8. For instance:
>
> ERROR (com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter) -
> runtimeError: message=[The data necessary to complete this operation is not
> yet available.] sourceName=[
> http://localhost:8081/xxxxx-web-1.4-SNAPSHOT/scripts/jquery-1.4.4.js]
> line=[897] lineSource=[null] lineOffset=[0]
>
> It could be related to the issue you mention?
>
> Josep
>
>
> 2010/11/23 sandy oberoi <[email protected]>
>
>
>> We recently moved to a newer version of webtest with htmlunit 2.8 snapshot
>> and have been facing issues with execution of onload. It seems like in the
>> newer version of webtest the onload events fires before the jQuery (version
>> 1.2.6) ready(). This was not the case in older version of webtest with
>> htmlunit 2.6.
>>
>> ~Sandy
>>
>>
>>
>>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.