Page 1 of 1

Selenium RC

Posted: 2010-03-31 6:01 am
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 <>.

Re: Selenium RC

Posted: 2010-03-31 10:29 am
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) {

Re: Selenium RC

Posted: 2010-04-01 8:53 am
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.

Re: Selenium RC

Posted: 2010-04-01 11:24 pm
by Ed
I made some changes to the code in the Subversion repository; try the latest version and see if that fixes the problem.

Re: Selenium RC

Posted: 2010-04-02 3:52 am
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 :)

Re: Selenium RC

Posted: 2010-08-19 2:45 am
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";

Re: Selenium RC

Posted: 2010-08-20 2:17 am
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

Re: Selenium RC

Posted: 2010-08-21 3:55 am
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.