开发者

Get XPATH expression with 2 spans in a div

<div class="grid_12">
<span class="gwt-InlineLabel">What ever</span>
 &nbsp;
(
<span class="gwt-InlineLabel">Endorsement</span> 
&nbsp;-&nbsp;
<span class="gwt-InlineLabel">Draft</span>)
</d开发者_运维问答iv>

I need an dynamic XPATH expression to assert the text " What ever Endorsement Draft"


You can use //div[@class='grid_12']//text(), but if you know the depth of the div, you can avoid using the first //.


Answer of Daniel Haley suggests to use //div[@class='grid_12']//text() but it will match &nbsp; too.

A better idea is to returns texts of spans only:

//div[@class='grid_12']/span/text()

(that will return ["what ever", "Endorsement", "Draft"]) and then concat them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜