Hi,
here the issue is not in an XMLHttpRequest problem but in the js construct
used to execute some script when the page is loaded: it sets the src of the
script to an invalid url (what causes the Connection Refused for WebTest)
and registers a listener to be executed once this script has been loaded.
(not really the smartest js construct, but that's not the point here ;-))
Latest build of HtmlUnit doesn't complain anymore about this kind of invalid
script src, so you wouldn't have this exception. Nevertheless onreadystate
is not currently supported in HtmlUnit (please open an issue for that) what
means that this can't be currently simulated.
Have you tried to simulate Firefox rather than IE? Perhaps are the construct
used by YahooUI for FF "smarter".
Marc.
Spencer Marks-2 wrote:
>
> Hi,
>
> I have pretty simple page but it does use Yahoo Calendar JS lib which
> used Ajax.
> When I run my extremely simple test, which is just meant to break up
> the page via the first example from the documentation:
>
> <project name="SimpleTest" basedir="." default="main">
>
> <property name="webtest.home" location="./canoo/build" />
>
> <import file="${webtest.home}/lib/taskdef.xml"/>
>
> <target name="main">
> <webtest name="myTest">
> <config
> host="localhost"
> port="8080"
> protocol="http"
> basepath="/" />
> <steps>
> <invoke
> url="Welcome.do" />
> <verifyTitle
> description="JavaScript Sandbox"
> text="JavaScript Sandbox" />
> </steps>
> </webtest>
> </target>
> </project>
>
>
> I get this
>
> Test step steps (/Users/sam/IdeaProjects/StatusReporter/test/
> SampleTest.xml:14: ) null failed with message "JavaScript error
> loading page http://localhost:8080/Welcome.do: Wrapped
> com.gargoylesoftware.htmlunit.ScriptException: Connection refused
> (http://localhost:8080/js/event/event.js#1750)"
>
>
> Typing http://localhost:8080/Welcome.do in the web browser works file
>
> Even http://localhost:8080/js/event/event.js
>
> brings up event.js line 1750
>
> looks like this (see below)
>
> I did some spend some time googling for a solution but the nearest
> thing I could find was the suggestion Canoo doesn't do Ajax very well
> (apologies if this incorrect!) and I might be out of luck. I hope I
> am not and that someone can point me in the right direction.
>
> Thanks in advance.
>
> S.
>
> 1750 snippet from event.js
>
>
> if (EU.isIE) {
>
> document.write(
> '<scr' + 'ipt id="_yui_eu_dr" defer="true" src="//:"></script>');
>
> var el = document.getElementById("_yui_eu_dr");
> el.onreadystatechange = function() {
> if ("complete" == this.readyState) {
> this.parentNode.removeChild(this);
> YAHOO.util.Event._ready();
> }
> };
>
> el=null;
>
> // Process onAvailable/onContentReady items when when the
> // DOM is ready.
> YAHOO.util.Event.onDOMReady(
> YAHOO.util.Event._tryPreloadAttach,
> YAHOO.util.Event, true);
>
> // Safari: The document's readyState in Safari currently will
> // change to loaded/complete before images are loaded.
> } else if (EU.webkit) {
>
> EU._drwatch = setInterval(function(){
> var rs=document.readyState;
> if ("loaded" == rs || "complete" == rs) {
> clearInterval(EU._drwatch);
> EU._drwatch = null;
> EU._ready();
> }
> }, EU.POLL_INTERVAL);
>
>
>
> _______________________________________________
> WebTest mailing list
> [email protected]
> http://lists.canoo.com/mailman/listinfo/webtest
>
>
--
View this message in context:
http://www.nabble.com/Just-getting-with-Canoo-%2B-JavaScript-Question-tf4083326.html#a11610967
Sent from the WebTest mailing list archive at Nabble.com.
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest