在Xpath中需要跨度标题

时间:2016-03-03 07:18:56

标签: xpath

我需要跨度标题文本(RS_GPO)作为我的xpath输出 这是代码:

<TD id="celleditableGrid07"  nowrap="nowrap"    style='padding:0px;'  >`
<DIV class='stacked-row'>
<span id="form(202567).form(TITLE).text" >
<span  title='RPS_AEM3'>RPS_AEM3</span>
</span>
</DIV>

<DIV class='stacked-row-bottom'>
<span id="form(202567).form(CONTENT).text" >
<span  title='RS_GPO'>RS_GPO</span>
</span>
</DIV>

我对xpath的意图是我希望将一个文本“RS_GPO”输入到一个变量中。 因为这是系统生成的文本。

先谢谢。

2 个答案:

答案 0 :(得分:0)

//span[@title='RS_GPO']

OR

//div[@class='stacked-row-bottom']/span[@id='form(202567).form(CONTENT).text']/span[@title='RS_GPO']

答案 1 :(得分:0)

//span[contains(@id,'form(CONTENT).text')]/span

如果您想要title属性的内容而不是元素的文本内容,那么:

//span[contains(@id,'form(CONTENT).text')]/span/@title