testing - Protractor - 元素在点 (968, 23) 不可点击

标签 testing protractor selenium-chromedriver

我正在编写有关注销功能的测试用例。执行代码时,它显示元素在该点不可点击。

  element.all(by.css('.dropdown-user a')).then(function(items) {
        items[0].click();
        ptor.sleep(500);
    });
view.html

<li class="dropdown dropdown-user">
	<a href="#" class="dropdown-toggle" id="logout" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
		<img alt="" class="img-circle" src="../../assets/admin/layout/img/avatar3_small.jpg"/>
		<span class="username username-hide-on-mobile">
					 </span>
		<i class="fa fa-angle-down"></i>
	</a>
	<ul class="dropdown-menu">
		<li>
			<a href=""><i class="icon-user"></i> My Profile </a>
		</li>
		<li>
			<a href=""><i class="icon-calendar"></i> My Calendar </a>
		</li>
		<li>
			<a href=""><i class="icon-envelope-open"></i> My Inbox <span class="badge badge-danger">3 </span></a>
		</li>
		<li>
			<a href=""><i class="icon-rocket"></i> My Tasks <span class="badge badge-success">7 </span></a>
		</li>
		<li class="divider">
		</li>
		<li>
			<a href=""><i class="icon-lock"></i> Lock Screen </a>
		</li>
		<li ng-click="logout()">
			<a href=""><i class="icon-key"></i> Log Out </a>
		</li>
	</ul>
</li>

有什么办法可以打开这个下拉菜单吗?你能告诉我如何编写代码来测试它吗?

最佳答案

你可以试试xpath的方式 //li[contains(@class, 'dropdown')]/ul[contains(@class, 'dropdown')].

不知道是不是你要的

关于testing - Protractor - 元素在点 (968, 23) 不可点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26379521/

相关文章:

在 clojure 测试中测试邮件服务器

javascript - 如何在 Angularjs Protractor 中使用全局函数?

node.js - 酱汁实验室点播 : multiCapabilities build information is not accepted

angular - Protractor ,根据 api 请求使用 angular2 模拟后端

testing - TestCafe:为什么 t.navigateTo(URL) 清除 cookie

php - 编码完成后测试PHP项目

selenium - 未为自定义 protractor.conf 文件创建 Webdriver 实例

python - 如何在 Windows 10 上同时运行多个 Python 代码?

Python - 通过 Selenium 获取文本框输入数据

python - 未以管理员身份运行时出现 "cannot create temp dir for user data dir"错误