we use the Python Selenium and django-selenium (SeleniumTestCase) bindings to run Selenium tests. Our test page has HTML elements that are created after some delay of seconds. Therefore, we want to wait for them and continue the test. The wait works, but each command fails after calling the wait:
class SomeTestCase(SeleniumTestCase): def test_something(self): ... (some testing code that works) self.driver.wait_element_present('span.available')
I debugged the selenium code and found out that "find_element_by_css_selector" internally sends an HTTP request to the selenium server (as in every command "check if xxx is there"):
http://127.0.0.1:42735/hub/session/<session-id>/element
But this request returns with status code 500 and this response text:
{ "status": 13, "value": { "message": "JSON.parse: unexpected non-digit", "stackTrace": [ { "methodName": "Dispatcher.executeAs/<", "fileName": "file:///tmp/tmpnUT34U/extensions/ fxdriver@googlecode.com /components/driver_component.js", "lineNumber": 7354 }, { "methodName": "Resource.prototype.handle", "fileName": "file:///tmp/tmpnUT34U/extensions/ fxdriver@googlecode.com /components/driver_component.js", "lineNumber": 7516 }, { "methodName": "Dispatcher.prototype.dispatch", "fileName": "file:///tmp/tmpnUT34U/extensions/ fxdriver@googlecode.com /components/driver_component.js", "lineNumber": 7463 }, { "methodName": "WebDriverServer/<.handle", "fileName": "file:///tmp/tmpnUT34U/extensions/ fxdriver@googlecode.com /components/driver_component.js", "lineNumber": 10152 }, { "fileName": "file:///tmp/tmpnUT34U/extensions/ fxdriver@googlecode.com /components/httpd.js", "lineNumber": 1935 }, { "methodName": "ServerHandler.prototype.handleResponse", "fileName": "file:///tmp/tmpnUT34U/extensions/ fxdriver@googlecode.com /components/httpd.js", "lineNumber": 2261 }, { "methodName": "Connection.prototype.process", "fileName": "file:///tmp/tmpnUT34U/extensions/ fxdriver@googlecode.com /components/httpd.js", "lineNumber": 1168 }, { "methodName": "RequestReader.prototype._handleResponse", "fileName": "file:///tmp/tmpnUT34U/extensions/ fxdriver@googlecode.com /components/httpd.js", "lineNumber": 1616 }, { "methodName": "RequestReader.prototype._processBody", "fileName": "file:///tmp/tmpnUT34U/extensions/ fxdriver@googlecode.com /components/httpd.js", "lineNumber": 1464 }, { "methodName": "RequestReader.prototype.onInputStreamReady", "fileName": "file:///tmp/tmpnUT34U/extensions/ fxdriver@googlecode.com /components/httpd.js", "lineNumber": 1333 } ] } }
As a result, all test runs are blocked and interrupted after a default timeout. According to https://code.google.com/p/selenium/wiki/JsonWireProtocol status 13 means "UnknownError", which does not make things more clear; -)
Has anyone discovered this too? Is there any way to solve this? I donβt know exactly what the reason may be, our page structure is pure html code. Thanks for any suggestions!