In my tests, which use Selenium client driver API, calling Selenium#retrieveLastRemoteControlLogs() results in "com.thoughtworks.selenium.SeleniumException: Internal Server Error".
This is because Selenium server (Jetty) returns HTTP response code 500 after invoking HttpCommandProcessor#getCommandResponseAsString("cmd=retrieveLastRemoteControlLogs"). In fact, each server response with code other than 200 (OK) raises a SeleniumException with non-descriptive generic message built from the response code, for example "Internal Server Error". I would personally prefer something more sensible, e.g. "error while processing command ABC, server returned code XYZ".
Anyway, this means that the error occurs on Selenium server (servlet bound to "/selenium-server/driver/" throws an exception). Root cause for this exception is in SeleniumDriverResourceHandler#doCommand(...) method, line 558:
...
} else if (RetrieveLastRemoteControlLogsCommand.ID.equals(cmd)) {
/* Trim logs to avoid Larsen effect (see remote control stability tests) */
LOGGER.info("Got result:" + results.substring(0, 30) + "... on session " + sessionId);
}
...
If result.length() >= 30, this will throw "java.lang.StringIndexOutOfBoundsException: String index out of range: 30".
Proposed fix: don't call results.substring(0, 30) unless you know its length is less than 30 characters.
I messed up the original diff
please find the correct diff attached: SeleniumDriverResourceHandler-corrected.diff