getLocationAbsUrl vs getCurrentUrl

后端 未结 4 1649
既然无缘
既然无缘 2021-02-18 22:36

In protractor, globally available browser object has two methods:

  • getLocationAbsUrl()

Returns the current absolute url f

4条回答
  •  孤城傲影
    2021-02-18 22:59

    As stated previously the getLocationAbsUrl - returns a full path to the current location. browser.get('http://angular.github.io/protractor/#/api'); expect(browser.getLocationAbsUrl()) .toBe('http://angular.github.io/protractor/#/api');

    The getCurrentUrl is utilized in a promise (schedule) to retrieve the URL of the current page. Typically, you would only use the getCurrentUrl when scheduling.

    webdriver.WebDriver.prototype.getCurrentUrl = function() { return this.schedule(new webdriver.Command(webdriver.CommandName.GET_CURRENT_URL),'WebDriver.getCurrentUrl()'); }

提交回复
热议问题