Xpath涉及启动 - 不工作

时间:2017-02-28 17:19:48

标签: selenium xpath

我遇到了xpath表达式的问题。请问有些人能帮助我吗?

所以我的xpath是 - ".//td[starts-with(text(), 'IMT - Office Admin:')]"

DOM:

<td>
 <input type="checkbox" name="partyEditF:j_id698:6:j_id700">
                IMT - Office Admin: Ability to edit everything within your office including the office's information and listings
</td>

1 个答案:

答案 0 :(得分:4)

您的.//td[starts-with(normalize-space(.), 'IMT - Office Admin')] 无法正常工作,因为实际上文字以空格/换行符开头,因此您需要摆脱它们。请尝试以下表达式

Ninject