【发布时间】:2018-04-01 10:26:56
【问题描述】:
使用 nightwatch,我在页面上查找元素时遇到问题,XPATH 很好,因为我使用 FirePath 找到了它。
我的页面代码:
<label class="switch " data-ng-repeat="item in values">
<input class="ng-pristine ng-untouched ng-invalid ng-invalid-required"
name="obtentionPermisConduiteAccompagneeSwitcher" value="N" ng-
model="$parent.model" ng-required="!$parent.model" required="required"
type="radio"/>
......
我的选择器:
input_conduiteAccompagnee: {
selector: './/input[@name="obtentionPermisConduiteAccompagneeSwitcher" and @value="N"]',
locateStrategy: 'xpath'
},
我的命令:
//conduite accompagnee
onglet_conducteur.waitForElementVisible('@input_conduiteAccompagnee',
10000);
onglet_conducteur.click('@input_conduiteAccompagnee');
browser.pause(3000);
但我有消息:
× 等待元素可见 10000 毫秒时超时。 - 期待 ted“可见”但得到:“不可见”
你有没有同样的问题?
【问题讨论】:
-
查看您的测试脚本代码可能会有所帮助。当您观看测试运行时,该项目是否真的可见?也许你需要先真正滚动到它(我偶尔会遇到需要强制滚动到元素的情况)
-
元素在页面下方。
标签: node.js selenium xpath nightwatch.js