【问题标题】:element not visible but present - protractor元素不可见但存在 - 量角器
【发布时间】:2018-09-30 21:06:08
【问题描述】:
我有带有我想点击的按钮的 div。
当用户在 div 上移动鼠标光标时元素可见。
如何点击按钮?我可以在 div 上移动光标,然后我会得到可见的按钮。
是另一种在不移动光标的情况下单击按钮的方法吗?
量角器中的自动化测试。
【问题讨论】:
标签:
javascript
typescript
protractor
automated-tests
【解决方案1】:
当您将鼠标悬停在隐藏的 div 上时,它不会隐藏,直到您离开鼠标
这样您就可以单击任何按钮等。您可以使用下面的代码
希望对你有帮助。
$(".mark").on({
mouseover: function() {
$(".icontent").stop().show(1000);
}
})
$(".m1").on({
mouseout: function() {
$(".icontent").stop().hide(1000);
}
})
$(".icontent").on({
mouseover: function() {
$(".icontent").stop().show(1000);
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="m1">
<a href="#" class="mark">hover anchor</a>
<div class="icontent" style="display: none;">
<p>
Test Content......
</p>
<a href="#" target="_blank" class="mark btn btn-danger">Button 1</a>
</div>
</div>