栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

getLocationAbsUrl和getCurrentUrl

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

getLocationAbsUrl和getCurrentUrl

GitHub
getCurrentUrl
来源

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

使用

schedule()
->
command()
包装器来解决来自
WebDriver.getCurrentUrl()


GitHub
Protractor.getLocationAbsUrl的
源代码

functions.getLocationAbsUrl = function(selector) {  var el = document.querySelector(selector);  if (angular.getTestability) {    return angular.getTestability(el).        getLocation();  }  return angular.element(el).injector().get('$location').absUrl();};

只是一个包装

$location.absUrl()
,等待 AngularJS 库加载


当前网址与绝对网址

指定的应用网址:

http://www.example.com/home/index.html#/Home

当前URL 解析为更多URI

/home/index.html#/Home

绝对网址 解析为

http://www.example.com/home/index.html#/Home

何时要使用绝对URL: 您想要使用完整域URL,而不是本地导航(URI),而要使用 绝对URL

  • 如果您的应用程序调用了 当前URL ,则测试应调用

    getCurrentUrl()

  • 如果您的代码要求提供 绝对URL ,则应调用测试

    getLocationAbsUrl()



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/382479.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号