2010-06-23 33 views
2

所有,轉換Xpath的定位器CSS定位在硒

此XPath定位器工作正常,在Firefox:

ctl00_ctl00_mainPage_rightColumn_wholeControl_grid_cell2_3_roleX_DDD_L_LBI2T0

這並不在IE瀏覽器。我一直試圖轉換爲CSS定位器 沒有成功。我試圖選擇的項目是賣家。這裏的 整個blob:

<div style="width: 168px; overflow: auto; height: 107px; padding-right: 0px;" class="dxlbd" id="ctl00_ctl00_mainPage_rightColumn_wholeControl_grid_cell2_3_roleX_DDD_L_­D"> 
    <input type="hidden" name="ctl00$ctl00$mainPage$rightColumn$wholeControl$grid$cell2_3$roleX$DDD$L" id="ctl00_ctl00_mainPage_rightColumn_wholeControl_grid_cell2_3_roleX_DDD_L_­VI" value="0">  
    <table cellspacing="0" cellpadding="0" border="0" style="width: 100%; border-collapse: separate;" id="ctl00_ctl00_mainPage_rightColumn_wholeControl_grid_cell2_3_roleX_DDD_L_­LBT"> 
    <tbody> 
    <tr class="dxeListBoxItemRow"> 
     <td class="dxeListBoxItem dxeListBoxItemSelected" id="ctl00_ctl00_mainPage_rightColumn_wholeControl_grid_cell2_3_roleX_DDD_L_­LBI0T0">Choose</td> 
    </tr> 
    <tr class="dxeListBoxItemRow"> 
     <td class="dxeListBoxItem" id="ctl00_ctl00_mainPage_rightColumn_wholeControl_grid_cell2_3_roleX_DDD_L_­LBI1T0">Buyer</td> 
    </tr> 
    <tr class="dxeListBoxItemRow"> 
     <td class="dxeListBoxItem dxeListBoxItemHover" id="ctl00_ctl00_mainPage_rightColumn_wholeControl_grid_cell2_3_roleX_DDD_L_­LBI2T0">Seller</td> 
    </tr> 
    <tr class="dxeListBoxItemRow"> 
     <td class="dxeListBoxItem" id="ctl00_ctl00_mainPage_rightColumn_wholeControl_grid_cell2_3_roleX_DDD_L_­LBI3T0">Buyer &amp; Seller</td> 
    </tr> 
    <tr class="dxeListBoxItemRow"> 
     <td class="dxeListBoxItem" id="ctl00_ctl00_mainPage_rightColumn_wholeControl_grid_cell2_3_roleX_DDD_L_­LBI4T0">Observer</td> 
    </tr> 
    </tbody> 
    </table> 
    </div> 

任何想法非常感謝。

Blake

回答

1

有幾種方法可以找到賣方單元。要使用基於細胞的嘗試的內容CSS定位是:

css=td:contains(Seller) 

如果id是靜態的那麼下面還應該工作,但是id是特別長,這可以想見,導致問題。我沒有自己測試過。

id=ctl00_ctl00_mainPage_rightColumn_wholeControl_grid_cell2_3_roleX_DDD_L_­LBI2T0 
+0

Dave,謝謝你的跟進。另外我已經嘗試了你的建議,但沒有奏效。然而,最後它是一件非常簡單的事情:在定位器中使用type命令,並將值設置爲Seller。我以爲我已經嘗試過,但無論如何,它的工作。無論如何,再次感謝Blake – bbe 2010-07-16 20:54:51