量角器:等待元素变得不可见/隐藏

编程入门 行业动态 更新时间:2024-10-26 03:38:59
本文介绍了量角器:等待元素变得不可见/隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我看到其他与量角器相关的帖子,提到了如何等待某个元素变得可见。但是,最近,我遇到了相反的用例。我想等待一个元素,直到它变得不可见。因为我找不到关于它的任何具体信息。我继续并提出了解决方案。

I saw other protractor related post mentioning about how to wait for an element to become visible. However, recently, I ran into an opposite use case. I wanted to wait for an element until it becomes invisible. Since I could not find anything specific about it. I went ahead and came up with a solution.

var ptor = protractor.getInstance(); ptor.wait(function() { return element(by.css('#my-css-here')).isDisplayed().then(function(isVisible){ console.log('is visible :' + isVisible); return !isVisible; }); }, 12000).then(function(){ //do whatever you want });

希望它会有所帮助。任何建议都值得欢迎。

hopefully it helps. any suggestion is welcome.

谢谢

推荐答案

使用elementexplorer(github/angular/protractor/blob/master/docs/debugging.md )我看了一下量角器对象,找到了一个对我来说效果很好的答案:

Using the elementexplorer (github/angular/protractor/blob/master/docs/debugging.md) I looked at the protractor object and found an answer that is working wonderfully for me:

var el = element(by.id('visibleElementId')); browser.driver.wait(protractor.until.elementIsNotVisible(el));

更多推荐

量角器:等待元素变得不可见/隐藏

本文发布于:2023-11-08 06:52:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1568644.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:量角器   元素

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!