WebDriverJS control flow

Protractor uses WebDriverJS under the hood.

WebDriverJS uses the concept of "control flow" to ensure that asynchronous tasks execute in the expected deterministic order.

So, the following will work as expected:

myElement.click();
browser.executeScript(...);

      

BUT if I add a function to the promise returned by one of these functions in the browser, does everything continue to work as expected?

For example:

browser.executeScript(...).then(function() {
  browser.navigate(...);
});

      

Will the stream flow with the above code be supported?

+3


source to share


1 answer


It should be. He called the framing in the WebDriverJs documentation :



flow.execute(function() {
  console.log('a');
}).then(function() {
  flow.execute(function() {
    console.log('c');
  });
});

flow.execute(function() {
  console.log('b');
});

// a
// c
// b

      

+6


source







All Articles