return new RemoteWebElement(new NodeId(0), this);
}
private RemoteWebElement retrieveDocumentAndCheckReady(long deadline) {
RemoteWebElement element = null;
String readyState = "";
while (!readyState.equals("complete")) {
if (deadline > 0 && System.currentTimeMillis() > deadline) {
throw new TimeoutException("Timeout waiting to get the document.");
}
try {
log.fine("trying to get the document");
element = retrieveDocument();
log.fine("got it");
readyState = element.getRemoteObject().call(".readyState");
log.fine("ready ? " + readyState);
} catch (Exception e) {
log.warning("Exception waiting for ready state, nodeId=" +
((element != null) ? element.getNodeId() : "null") + ": " + e +
". Retrying ...");
throw new WebKitSeemsCorruptedException();
}
}
return element;