views:

44

answers:

1

using xpath or css : How to get something which is selected on page using following html code. in following code, Element1 is selected on page and I wanted to find name of element that is selected on page.

<div id="idc" class="tre">
  <ul id="idCatT_srt_ul" class="abc">
    <li class="treN treB treSelected" title="Element1 title">
      <span class="spclass">Element1</span>
    </li>
  </ul>
</div>
+1  A: 

Guessing that you're looking for the <li> that contains selected you can do that with Xpath or CSS selectors like this:

XPath: (if I remember right...)

//*[contains(@class,"selected")]

CSS Selectors:

.treSelected
Jweede
Hi Jweede, thank you for immediate reply. I'm looking for span text , in this example which is "Element1"
doneright
got it using following css . thankscss=.treeSelected > span
doneright