如何在量角器中打印 webelement? [英] How to print the webelement in protractor?

查看:78
本文介绍了如何在量角器中打印 webelement?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当量角器等待元素超时时,我想将该元素作为消息的一部分打印出来.

I want to print the element as part of a message when protractor times out waiting for the element.

waitForElementDisplayed(webDriverEl, time = timeOut) {
  let EC = protractor.ExpectedConditions;
  let isVisible = EC.visibilityOf(webDriverEl);
  browser.wait(isVisible, time, `Timed out waiting for element ${webDriverEl} to be visible`);
}

尝试正确打印元素没有任何运气.任何帮助表示赞赏.

Have not had any luck trying to get the element to print correctly. Any help is appreciated.

推荐答案

您可以使用 element.locator().toString() 来获取 webelement 的定位器.

You can use element.locator().toString() to get the locator of a webelement.

browser.wait(isVisible, time, "Timed out waiting for element "+element.locator().toString() +" to be visible"); 

这篇关于如何在量角器中打印 webelement?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆