Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control flow getting stuck #796

Closed
hankduan opened this issue Jul 16, 2015 · 4 comments
Closed

Control flow getting stuck #796

hankduan opened this issue Jul 16, 2015 · 4 comments

Comments

@hankduan
Copy link

Here's another attempt at reproducing the hanging webdriver control flow we've been seeing at protractor.
My previous attempt (#715) has been close, but hopefully this is something new. In particular, this hangs with webdriver 2.46.1 but not 2.45.1

var webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder().
  usingServer('http://localhost:4444/wd/hub').
  withCapabilities(webdriver.Capabilities.chrome()).
  build();
var flow = webdriver.promise.controlFlow();

driver.get('http://www.w3schools.com/html/html_lists.asp');

var printTexts = function(webElems) {
  var attrVals = webElems.then(function(arr) {
    var results = arr.map(function(webElem) {
      return webElem.getText();
    });
    return webdriver.promise.all(results);
  });

  flow.execute(function() {
    return attrVals.then(function(res) {
      console.log(res[0]);
    });
  });

  return true;
};

driver.findElements(webdriver.By.css('.example_result li')).then(function(arr) {
  var result = arr.map(function(webElem) {
    var webElemsPromise = webdriver.promise.fulfilled(webElem).then(function(webElem) {
      return [webElem];
    });
    return webdriver.promise.fullyResolved(printTexts(webElemsPromise));
  });
  return webdriver.promise.all(result);
})

driver.quit();
@nbeloglazov
Copy link

I believe it was caused by this change: 53b0c0f#diff-b1976f46bdbb6d0d51ba6baa46156d61R519. When I revert it back to use getSchedulingFrame - it's not blocked and program finishes printing text. I'll try to understand how control flows work/implemented and see if I come with a real fix.

@juliemr
Copy link
Contributor

juliemr commented Sep 29, 2015

Small note: the public URL for w3 schools used for testing has changed its css slightly. To run this example, now, replace the locator with webdriver.By.css('.w3-example li').

@jleyba
Copy link
Contributor

jleyba commented Sep 29, 2015

FYI, I spent the weekend working on this. I fixed this bug, but I'm still working through all of the regression tests. I will probably finish everything up this coming weekend.

@juliemr
Copy link
Contributor

juliemr commented Sep 29, 2015

@jleyba awesome, thanks!

@jleyba jleyba closed this as completed in c42999e Oct 18, 2015
@lock lock bot locked and limited conversation to collaborators Aug 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants