【发布时间】:2016-05-27 18:59:45
【问题描述】:
我有我的 ng-repeat 复选框选择:
<label> <input style="display: inline-block; margin-top: 5px"
type="checkbox"
ng-model="entity.checked"
ng-change="getEntityFromModal(entity.val, entity.checked)" /> <span>{{entity.val}}</span>
</label>
我正在尝试使用以下内容找到由标签 01 表示的复选框:
multiCheckBoxXPath = "//input(@ng-model='entity.checked')/label[contains(text(),'" +value.substring(0, 2) +"')]";
其中 value 是复选框旁边显示的内容的拉长 string 版本。显示前两个字母。
我使用[contains(text()) 通过标签找到它,然后使用分配的ng-model 尝试选择相应的复选框。
不幸的是,我得到了 -
Unable to find //input(@ng-model='entity.checked')/label[contains(text(),'01')]
我有点卡在这里,所以任何想法都值得赞赏。
【问题讨论】:
-
为什么您的错误消息中缺少右括号
)]...只是一个错字,或者他们真的不存在吗??? -
嗨,根据源代码,您的路径应包含 @ng-model='entity.checked' 而不是 @ng-model='depot.checked'
-
再次,道歉是一个错字 - 我有两个相同的复选框列表,我一定是在复制时感到困惑。固定。
标签: angularjs selenium xpath selenium-webdriver