【问题标题】:Find and take value of href using protractor使用量角器查找并获取 href 的值
【发布时间】:2017-03-31 12:42:03
【问题描述】:

enter image description here

我搜索并阅读了许多指南,但它不起作用。有人可以帮我吗?我想获得图像中的 href 值。感谢您阅读我的帖子。

【问题讨论】:

    标签: protractor href


    【解决方案1】:

    您可以使用getAttribute() 方法获取webelement 中任何可用属性的值。在您的情况下,您需要找到相应的元素,并且可以使用下面的代码来获取 href 值,

    element(by.css("a")).getAttribute("href").then(function(hrefValue){
      console.log("href value",hrefValue);
    })
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-11-23
      • 1970-01-01
      • 1970-01-01
      • 2015-05-20
      • 1970-01-01
      • 2015-05-12
      • 1970-01-01
      相关资源
      最近更新 更多