Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What to do when webdriverjs never calls a continuation, and just hangs?

I'm running webdriverjs and having an issue where webdriver just goes idle and seems to stop running events. I am using webdriver to launch a new browser, and then the code in that browser connects to the webdriver session and runs test commands.

This seems to work fine, but then with some sequences of commands, webdriver just stalls. For example, in my test:

driver.findElement(my_element).then(function(element) {
  console.info("found");
  element.getTagName().then(function(name) {
    console.info("got tag name", name);
  });
});

The browser outputs the first "found" log line, but not the second "got tag name". Webdriver does not appear to fail - there are no exceptions in the log, and if I register an errback on the getTagName promise, it never gets called. It simply just doesn't happen.

The webdriver instance is a selenium-standalone-server. Looking at its logs, I see the first findElement request:

12:59:43.382 INFO - Executing: [execute script: return (function lookupElement(id) {
  var store = document["$webdriver$"];
  if(!store) {
    return null
  }
  var element = store[id];
  if(!element || element[id] !== id) {
    return[]
  }
  return[element]
}).apply(null, arguments);, [51d37tw]] at URL: /session/1337200865492/execute)
12:59:43.393 INFO - Done: /session/1337200865492/execute

But I never see the second request, so it would seem the webriver JS never ends up making the call to the server.

I'm stepping through the webdriver code to see what's going on, but the promise framework uses lots of closures and it's very hard to inspect state effectively. Does anyone have any familiarity with this problem?

like image 836
Greg S Avatar asked Nov 04 '22 23:11

Greg S


1 Answers

This is a bug in WebdriverJS, acknowledged and fixed by the selenium team. See http://code.google.com/p/selenium/issues/detail?id=3930

like image 181
Greg S Avatar answered Nov 12 '22 19:11

Greg S