Ben Aston Ben Aston - 1 year ago 106
Javascript Question

WebDriverJS control flow

Protractor uses WebDriverJS under the hood.

WebDriverJS uses the concept of "control flow" to ensure async tasks are executed in the expected deterministic order.

So the following will work as expected:;

BUT, if I add a function to the then of the promise returned by one of these functions on browser, will everything just continue to work in the expected way?

For example:

browser.executeScript(...).then(function() {

Will control flow be maintained with the above code?

Answer Source

Should be. It's called framing in WebDriverJs' documentation:

flow.execute(function() {
}).then(function() {
  flow.execute(function() {

flow.execute(function() {

// a
// c
// b