Failed: Cannot read property 'all' of unde

2019-07-29 03:23发布

问题:

We have been using protractor.promise.all([promise1, promise2, promise3]) extensively to resolve multiple promises up until the upgrade to Protractor 4.0.0.

Now, it is failing with:

Failed: Cannot read property 'all' of undefined

What should we use instead of protractor.promise.all(), or is this a bug?

回答1:

In version 4.0.0, the function protractor.promise.all is no longer present in the protractor.promise namespace:

https://github.com/angular/protractor/blob/master/lib/ptor.ts

It is just a shortcut to the promise namespace from the Selenium library. So as an alternative:

var promise = require('selenium-webdriver').promise;

promise.all([promise1, promise2, promise3])