Selenium RC

Questions, problems, suggestions, bug reports, and so on.
Post Reply
orgone
Posts: 6
Joined: 2010-03-27 8:27 am

Selenium RC

Post by orgone »

I have some tests written on PHP using the Selenium RC. Now I want to run them through JSCoverage, but can't open JSCoverage using Selenium RC.

JSCoverage started as proxy server:

Code: Select all

jscoverage-server --verbose --ip-address=10.10.10.10 --port 9999 --no-instrument='http://10.10.10.10:8080/site/js/externals' --proxy
Browser is configured to use it.

It's OK when I call "open('http://10.10.10.10:8080/jscoverage.html');" from Selenium IDE. But there are some js problems when I call it from Selenium RC.

I see the following in a browser tab:
Image

It seems like this js code does not work:

Code: Select all

ProgressBar.init(progressBar);
Does anybody can help?

UPDATE: Firebug reports an error:

Code: Select all

Permission denied for <http://10.10.10.10:8080> to get property Window._$jscoverage from <>.
orgone
Posts: 6
Joined: 2010-03-27 8:27 am

Re: Selenium RC

Post by orgone »

Found a workaround.

This check is erroneous for Selenium RC for some reason. Skipped it because I don't use the inverted mode.

Code: Select all

Index: jscoverage.js
===================================================================
--- jscoverage.js       (revision 527)
+++ jscoverage.js       (working copy)
@@ -31,7 +31,8 @@
   }
   catch (e) {}
 
-  if (w.opener && w.opener.top._$jscoverage) {
+  // if (w.opener && w.opener.top._$jscoverage) {
+  if (false) {
     // we are in inverted mode
     jscoverage_isInvertedMode = true;
     if (! w._$jscoverage) {
orgone
Posts: 6
Joined: 2010-03-27 8:27 am

Re: Selenium RC

Post by orgone »

Unfortunately, js code does not work under Selenium RC :(
Even in Inverted instrumenting mode.
I see js errors like these, when I simply open the page with instrumented js code:

Code: Select all

Permission denied for <http://10.10.10.10:8080> to get property Window._$jscoverage from <>.
[Break on this error] if (typeof top.opener._$jscoverage...& top.opener._$jscoverage !== null) {
Open.js?...0032618 (line 5)
Permission denied for <http://10.10.10.10:8080> to get property Window._$jscoverage from <>.
[Break on this error] if (typeof top.opener._$jscoverage...& top.opener._$jscoverage !== null) {
Start....0032618 (line 5)
Permission denied for <http://10.10.10.10:8080> to get property Window._$jscoverage from <>.
[Break on this error] if (typeof top.opener._$jscoverage...& top.opener._$jscoverage !== null) {
locale...0032618 (line 5)
_$jscoverage is undefined
[Break on this error] _$jscoverage['locale.js'][9]++;
locale...0032618 (line 48)
Node was not found" code: "8
[Break on this error] Filtered chrome url chrome://flashblock/content/flashblock.xml
Browser security settings do not affect.
Ed
Posts: 120
Joined: 2008-10-11 6:52 pm

Re: Selenium RC

Post by Ed »

I made some changes to the code in the Subversion repository; try the latest version and see if that fixes the problem.
orgone
Posts: 6
Joined: 2010-03-27 8:27 am

Re: Selenium RC

Post by orgone »

Ed wrote:I made some changes to the code in the Subversion repository; try the latest version and see if that fixes the problem.
Wah! It works from now! Great thanks and a lot of respect to you! :D
I'm just happy :)
tn

Re: Selenium RC

Post by tn »

I still get this issue with jscoverage-0.5-windows.zip and FireFox driven by Selenium (work fine manually)

Code: Select all

Error: uncaught exception: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPrefBranch.clearUserPref]"  nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame :: chrome://dotnetassistant/content/bootstrap.js :: BootStrapDotNetAsssitantExtension :: line 52"  data: no]

Error: Permission denied for <http://localhost:8080> to get property Window._$jscoverage from <>.
Source File: http://localhost:8080/jscoverage.js
Line: 34
  if (w.opener && w.opener.top._$jscoverage) {


Error: ProgressBar is undefined
Source File: http://localhost:8080/jscoverage.js
Line: 311
  ProgressBar.init(progressBar);


Error: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIChannel.contentType]"  nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)"  location: "JS frame :: file:///C:/Program%20Files/Mozilla%20Firefox/components/FeedProcessor.js :: FP_onStartRequest :: line 1440"  data: no]
Source File: file:///C:/Program%20Files/Mozilla%20Firefox/components/FeedProcessor.js
Line: 1440
    channel.contentType = "application/vnd.mozilla.maybe.feed";
Ed
Posts: 120
Joined: 2008-10-11 6:52 pm

Re: Selenium RC

Post by Ed »

tn wrote:I still get this issue with jscoverage-0.5-windows.zip and FireFox driven by Selenium (work fine manually)

Code: Select all

Error: Permission denied for <http://localhost:8080> to get property Window._$jscoverage from <>.
Source File: http://localhost:8080/jscoverage.js
Line: 34
  if (w.opener && w.opener.top._$jscoverage) {
It looks like the fix mentioned above (a few months ago) may not work in all possible cases ... I am working on some changes in the Subversion repository which may fix the problem.

Generally, however, when using Selenium it may be better to use the approach described here (instead of opening a new window with jscoverage.html):

http://mercenary-code.blogspot.com/2010 ... enium.html
Guest

Re: Selenium RC

Post by Guest »

I am working on some changes in the Subversion repository which may fix the problem
I updated and built with Cygwin and the fix did indeed work. Will look at the other approach linked to though. Thanks.
Post Reply