English 中文(简体)
xPath in Selenium - What am mypractic?
原标题:xPath in Selenium - what am I doing wrong?
  • 时间:2009-10-09 09:29:03
  •  标签:

我有一页,上面有以下几页:

...
<tbody id="c_scopePane4_tbody">
<tr id="c_scopePane4_tr_header">
...
</tr>
</tbody>
...

现在,Im试图具体说明<tr> 标签,在Selenium内部有XPath表述。 我在此试图:

 //tr[@id= c_scopePane4_tr_header ]

这告诉我

[error] locator not found: //tr[@id= c_scopePane4_tr_header ], error = Error:
Element //tr[@id= c_scopePane4_tr_header ] not found 

但是,如果我改用XPath的话说:

 //*[@id= c_scopePane4_tr_header ]

......它起作用。 什么?

最佳回答

它用同样的刀子为我工作。 或许,在你的超文本中还有造成问题的东西? 您是否拥有一个以上<代码>的编号、编号和编号;(或任何其他内容)和同一个索引?

由于国际身份识别器(要说)是独一无二的,因此,你应该能够以信任的方式使用你的第二口号。 或者,你可以使用以下文字,但可以肯定地在座标之前先使用<条码>xpath=。 • the

xpath=id( c_scopePane4_tr_header )

此外,如果你只是想选择<代码><tr>要素,你也可以使用以下要素之一:

  • c_scopePane4_tr_header
  • identifier=c_scopePane4_tr_header
  • id=c_scopePane4_tr_header
问题回答

候补成员 体格:

css=tr#c_scopePane4_tr_header

页: 1 形式:

dom=document.getElementById("c_scopePane4_tr_header")




相关问题
热门标签