views:

1170

answers:

2

I've got a bunch of selenium test cases set up in a JUnit class as four methods. The first runs fine - but the remaining three close the Firefox browser before the final step of the method is complete - giving a

ERROR: Command execution failure. Please search the forum at http://clearspace.openqa.org for error details from the log window.  The error message is: this.page().currentDocument is undefined
com.thoughtworks.selenium.SeleniumException: ERROR: Command execution failure. Please search the forum at http://clearspace.openqa.org for error details from the log window.  The error message is: this.page().currentDocument is undefined

Setup is following:

Ant based execution

  • Java 1.5
  • Eclipse 3.5
  • Selenium Server 1.0.1
  • Selenium Client Driver 1.0.1

IDE

  • Java 1.5
  • Eclipse 3.5
  • Selenium Server 1.0.1
  • Selenium Client Driver 1.0.1

I'm hoping to track down the root cause


It is crashing on the following line:

This is the modification to the user-extensions.js file:

Selenium.prototype.getElementBody = function(elementId) {
return this.outerHTML(this.page().currentDocument.getElementById(elementId));
};

This is what is being called:

commandProcessor.getString("getElementBody", "idOfElement");
A: 

Can you show us your JUnit test class ?

I know from personnal experience that once in a while Selenium tests can crash for no apparent reason, but your problem seems to be happening each time so it might have something to do with your code/script.

Afraid I can't help you without some more details.

SAKIROGLU Koray
A: 

I have never seen a command called getString part of the Selenium API so think that is why your tests are failing.

The other thing is have you told Selenium RC to use the user-extensions.js file that you have modified with the following -userExtensions user-extensions.js argument? I have never found it beneficial to use user-extensions in Se:RC and instead use .getEval() commands.

what you want would be selenium.getEval("this.browserbot.getUserWindow().getElementByID(id).outerHTML");

I have cleaned up your JavaScript for you. The this.browserbot.getUserWindow() gives you access to the Selenium JavaScript object which has the page in it.

I hope that helps

AutomatedTester