Is there a way to resolve multiple promises with Protractor?

后端 未结 3 1334
终归单人心
终归单人心 2021-01-01 23:35

I have this:

element(by.id(\'x\')).sendKeys(\'xxx\').then(function(text) {
  element(by.id(\'y\')).sendKeys(\'yyy\').then(function(text) {
     element(by.id         


        
3条回答
  •  旧巷少年郎
    2021-01-02 00:16

    You don't need to chain any promises because protractor will wait until all the statements are done: https://github.com/angular/protractor/blob/master/docs/control-flow.md

    element(by.id('x')).sendKeys('xxx');
    element(by.id('y')).sendKeys('yyy');
    element(by.id('z')).sendKeys('zzz');
    expect(element(by.id('myButton'));
    

    If you want to resolve multiple promises use:

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

    For example: https://github.com/angular/protractor/blob/d15d35a82a5a2/lib/protractor.js#L327

提交回复
热议问题