如何点击隐藏的元素在量角器? [英] How to click on hidden element in protractor?

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

问题描述

我只当我将鼠标悬停在它是可见的元素。

I have an element which is visible only when I hover over it.

我已经写了下面的code到绳拉过面板,使该元素是可见的。

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.

推荐答案

继code为我工作。

  ptor.actions().
    mouseMove(ptor.findElement(protractor.By.xpath('//*@id="productapp"]/div/div/di‌​v[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();
    });

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

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