Convert Xpath locator to CSS locator in Selenium

All,

This xpath locator works fine in Firefox:

ctl00_ctl00_mainPage_rightColumn_wholeControl_grid_cell2_3_roleX_DDD_L_LBI2­T0

This does not work in IE. I have been trying to convert to CSS locator without success. The item I am trying to select is Seller. Here's the whole 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> 

Any ideas greatly appreciated.

Blake

Answers


There are a few ways that you could locate the seller cell. To locate it using CSS based on the content of the cell try:

css=td:contains(Seller)

If the id is static then the following should also work, however the id is unusually long, which could conceivably cause issues. I haven't tested this myself.

id=ctl00_ctl00_mainPage_rightColumn_wholeControl_grid_cell2_3_roleX_DDD_L_­LBI2T0

Need Your Help

c++ forward declaration and incomplete type

c++ circular-dependency forward-declaration incomplete-type

Hello I have trouble working with forward declaration. I can't access the forwarded class function, though I need to do so.

Doing model selection in python / scipy

python numpy scipy statsmodels

During model selection, sometimes the likelihood-ratio test, or analysis using BIC (Bayesian Information Criterion) are often necessary. While I could definitely do it by hand, I was wondering, is ...