无法点击量角器中的隐藏元素?(请浏览图片.) [英] Not able to click on hidden element in protractor?(Please go through the image.)

查看:16
本文介绍了无法点击量角器中的隐藏元素?(请浏览图片.)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是 HTML 代码:

Here is the HTML code :

<li class="subdropdown">
                    <a href="" class="submenu-toggle">Create Position</a>
                    <ul class="list-unstyled dropdown-submenu" role="menu">
                        <li style="cursor: pointer;">
                            <a ng-click="openPositionModal($event)"><i class="glyphicon glyphicon-list-alt"></i> New Position</a>
                        </li>

这是我的测试用例:

1) Move  the cursor on "Create position" toggle menu.
2) After the mouse hover, click on the "New position" menu list.

推荐答案

browser.actions()、by link text"和by partial link text"定位器在这里应该有所帮助:

browser.actions(), "by link text" and the "by partial link text" locators should help here:

var EC = protractor.ExpectedConditions;

// open up the menu

// choose position
var choosePosition = element(by.linkText('Create Position'));
browser.actions().mouseMove(choosePosition).perform();

// choose new position
var newPosition = $('a[ng-click*=openPositionModal]');
browser.wait(EC.elementToBeClickable(newPosition), 3000);
newPosition.click();

这篇关于无法点击量角器中的隐藏元素?(请浏览图片.)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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