How to make parts of Protractor wait or become synchronous?

岁酱吖の 提交于 2019-12-08 08:52:28

How to make parts of Protractor wait or become synchronous?

You can wait for the url to change with the help of browser.wait():

var urlChanged = function(url) {
  return function () {
    return browser.getCurrentUrl().then(function(actualUrl) {
      return url === actualUrl;
    });
  };
};

element(by.id('ID')).sendKeys('SomeUserName');
element(by.id('password')).sendKeys('SomePassword');
element(by.partialButtonText('Sign in')).click();

browser.wait(urlChanged("http://NextURLAfterClick")), 5000);

where urlChanged, in selenium terms, is a "Custom Expected Condition".

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!