RE: Include command error analysis and workaroun d

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

RE: Include command error analysis and workaroun d

Bailey Moore
I got the include extension to work.

The code added to user-extensions.js expects that you are running Selenium
by loading the default document, for example
http://localhost/selenium/ It fails and produces the odd behavior described
previously in this thread if you use
http://localhost/selenium/TestRunner.html + (URL parameters containing "/").

Here is a one line work around. An excerpt of Alexandre's code appears
below. Add the line of code tagged 119 below. The error occurs because of
the regular expression in the line tagged 117.

        // the xml http requester to fetch the page to include
        var requester = newXMLHttpRequest();
        var baseUrl = ""
        // if locator does not begin with /
        if (!locator.match(/^\//))
        {
            // relative url => selenium root + uri test
117         baseUrl = document.URL.match(new RegExp("^(.+/)[^/]+$"))[1] //
base uri = char - / - chars other than /
        }
119     baseUrl = baseUrl.replace(/.+\.htm.*/, ""); // Adding this line will
work around the problem
        var url = baseUrl + locator
        requester.open("GET", url, false) // synchron mode ! (we don't want
selenium to go ahead)
        requester.send(null)
        if ( requester.status != 200 )
        {
            throw new Error("Error while fetching " + url + " server
response has status = " + requester.status + ", " + requester.statusText )
        }
 
Many thanks to Alexandre for a fantastically useful user extension!

-----Original Message-----
From: jhin [mailto:[hidden email]]
Sent: Tuesday, January 31, 2006 5:00 AM
To: [hidden email]
Subject: [selenium-users] Re: Include


If you got the include command to work, I would be grateful to know what
version you were using. I am using the 0.6.0 release and it is not working.

Also, if you can suggest that a different version of selenium may work with
the include command, I would be grateful if you include a URL to download
this.

Thanks
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=64&messageID=3111#3111

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Include command error analysis and workaroun d

Bailey Moore
So, looking back at what I sent a minute before I should have...

This is equivalent to not needing the baseUrl even if the locator doesn't
begin with "/". Hence, the following substitution for the code block
included in the previous message:

        // the xml http requester to fetch the page to include
        var requester = newXMLHttpRequest();
        requester.open("GET", locator, false) // synchron mode ! (we don't
want selenium to go ahead)
        requester.send(null)
        if ( requester.status != 200 )
        {
            throw new Error("Error while fetching " + url + " server
response has status = " + requester.status + ", " + requester.statusText )
        }

I tested this change using Selenium 0.6.0 in MSIE 6.0.28 and Netscape 8.0.4
on Windows 2000.

I was getting the error where the control panel frame and the AUT frame
panel were being included in the test pane instead of the target tests
before I made any changes. I was the following URL to run selenium:
http://localhost/selenium06/TestRunner.html?test=bhipsnetproject/TestSuites/
BaileyTestSuite.html

Hope this helps isolate the version difference.
Bailey

-----Original Message-----
From: Bailey Moore
Sent: Thursday, February 23, 2006 6:50 PM
To: '[hidden email]'
Subject: RE: [selenium-users] Include command error analysis and workaround


I got the include extension to work.

The code added to user-extensions.js expects that you are running Selenium
by loading the default document, for example http://localhost/selenium/ It
fails and produces the odd behavior described previously in this thread if
you use http://localhost/selenium/TestRunner.html + (URL parameters
containing "/").

Here is a one line work around. An excerpt of Alexandre's code appears
below. Add the line of code tagged 119 below. The error occurs because of
the regular expression in the line tagged 117.

        // the xml http requester to fetch the page to include
        var requester = newXMLHttpRequest();
        var baseUrl = ""
        // if locator does not begin with /
        if (!locator.match(/^\//))
        {
            // relative url => selenium root + uri test
117         baseUrl = document.URL.match(new RegExp("^(.+/)[^/]+$"))[1] //
base uri = char - / - chars other than /
        }
119     baseUrl = baseUrl.replace(/.+\.htm.*/, ""); // Adding this line will
work around the problem
        var url = baseUrl + locator
        requester.open("GET", url, false) // synchron mode ! (we don't want
selenium to go ahead)
        requester.send(null)
        if ( requester.status != 200 )
        {
            throw new Error("Error while fetching " + url + " server
response has status = " + requester.status + ", " + requester.statusText )
        }
 
Many thanks to Alexandre for a fantastically useful user extension!

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]