How to click on hidden element in protractor?(如何单击量角器中的隐藏元素?)
问题描述
我有一个元素,只有当我将鼠标悬停在它上面时才可见.
I have an element which is visible only when I hover over it.
我编写了以下代码来悬停在面板上,以便元素可见.
I've written following code to hove over the panel so that the element is visible.
ptor.actions().
mouseMove(ptor.findElement(protractor.By.xpath('//*[@id="productapp"]/div/div/div[2]/div/div/div/div[2]/div/div/div/div[4]/table/thead/tr/th[2]'))).
perform();
ptor.element.all(by.tagName('i')).then(function(elm){
elm[0].click();
});
现在我试图点击它,但它显示 -ElementNotVisibleError:元素不可见量角器错误.
Now I tried to click on it, but it says - ElementNotVisibleError: element not visible error in protractor.
基本情况是,我想将鼠标悬停在面板上,然后单击隐藏的元素,因为该元素在悬停之前是不可见的.
Basic scenario is, I want to hover over a panel and then click on the hidden element, because the element is not visible until it is hovered over.
推荐答案
以下代码对我有用.
ptor.actions().
mouseMove(ptor.findElement(protractor.By.xpath('//*@id="productapp"]/div/div/div[2]/div/div/div/div[2]/div/div/div/div[4]/table/thead/tr/th[2]'))).perform();
ptor.element.all(by.css('i.ng-scope.tea-ic-sorting')).then(function(elm){
elm[0].click();
});
这篇关于如何单击量角器中的隐藏元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何单击量角器中的隐藏元素?


基础教程推荐
- 直接将值设置为滑块 2022-01-01
- 如何使用JIT在顺风css中使用布局变体? 2022-01-01
- 我可以在浏览器中与Babel一起使用ES模块,而不捆绑我的代码吗? 2022-01-01
- Vue 3 – <过渡>渲染不能动画的非元素根节点 2022-01-01
- Electron 将 Node.js 和 Chromium 上下文结合起来意味着 2022-01-01
- Chart.js 在线性图表上拖动点 2022-01-01
- 如何使用TypeScrip将固定承诺数组中的项设置为可选 2022-01-01
- 用于 Twitter 小部件宽度的 HTML/CSS 2022-01-01
- html表格如何通过更改悬停边框来突出显示列? 2022-01-01
- 自定义 XMLHttpRequest.prototype.open 2022-01-01