【发布时间】:2012-09-02 08:44:39
【问题描述】:
我使用 Firebug 的 Inspect Element 来捕获网页中的 XPath,它给了我类似的东西:
//*[@id="Search_Fields_profile_docno_input"]
我在 IE 中使用 Bookmarklets 技术来捕获同一对象的 XPath,我得到了类似的东西:
//INPUT[@id='Search_Fields_profile_docno_input']
注意,第一个没有 INPUT,而是有一个星号 (*)。为什么我得到不同的 XPath 表达式?我在测试中使用哪一个是否重要,例如:
Selenium.Click(//*[@id="Search_Fields_profile_docno_input"]);
或
Selenium.Click(//INPUT[@id='Search_Fields_profile_docno_input']);
【问题讨论】:
标签: xpath selenium firebug bookmarklet