2013-11-04 65 views
0

我想找到與文本「CCCC CCCC」,但無濟於事元素的XPath查詢 - 嘗試查找表元素的相對路徑

我已經試過// [@類=「ELINE」] // [含有( 'CCCC CCCC'。)],但沒有用

這裏是源代碼

<tr class="eline"> 
<tr> 
<td class="norm" nowrap=""/> 
<td class="norm" nowrap=""> 
<td class="norm" nowrap=""> 
<td class="norm" nowrap="">cccc cccc </td> 
<td class="norm" nowrap="">99999 </td> 
<td class="norm" nowrap=""/> 
<td> 
<td class="norm" nowrap=""> 
<td class="norm" nowrap=""> 
<td class="norm" nowrap="">testcase33 testcase33 </td> 
<td class="norm" nowrap="">33100 </td> 

回答

0

XPath的應該是這樣的:

//tr[@class='eline']/td[@class='norm' and contains(.,'cccc cccc')] 
+0

嗨,這不會返回任何值由於某種原因 – user1156718

+0

XPath是正確的,也許這是因爲你使用硒,必須用'.text()獲取文本' –