Trying my hands on selenium these days. When I inspect the element with firebug this is displayed as selected: None

I am not able to locate this element that has span element as None How do I locate/find this element.

  • show us the HTML code please
    – Yu Zhang
    Commented Sep 19, 2016 at 8:16
  • <a class="chosen-single" tabindex="-1"><span>None</span><div><b></b></div></a> Commented Sep 19, 2016 at 8:18

5 Answers 5


You can locate this element via Xpath or Css selector without using its attribute, which it does not have any.

For example:


a[class='chosen-single'] span 
  • Still not working the xpath expression I used is: driver.findElement(By.xpath("//a[@class='chosen-single']/span")).click(); Commented Sep 19, 2016 at 8:32
  • can you please provide the whole page's html?
    – Yu Zhang
    Commented Sep 19, 2016 at 8:54
  • <div id="id_center_chosen" class="chosen-container chosen-container-single chosen-with-drop chosen-container-active" style="width: 195px;" title=""> <a class="chosen-single" tabindex="-1"> <span>None</span> Commented Sep 19, 2016 at 9:58

You can use below snippet:




Best option would be try locating the element using s Selenium IDE with Firefox. Then Navigate to Options->Format and select the language that your are working on. Then Again from the IDE click on the "Source" tab and look how Selenium IDE perform the element identification part.


this could be your help

how to find int value within span class Selenium C#

try to bring exact error if possible


You can try contains.Example:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.