0

I am new to Xpath. What is the following piece of code checking for ? Does it check for both these class "a b" when retrieving span elements.

HtmlSpan resultsSpan =  (HtmlSpan) page.getByXPath("//span[contains(@class,'a b')]").get(0);

Thanks

BDL
  • 19,702
  • 16
  • 49
  • 50
prit kalra
  • 197
  • 2
  • 17
  • this might be useful : [How can I find an element by CSS class with XPath?](http://stackoverflow.com/questions/1604471/how-can-i-find-an-element-by-css-class-with-xpath) – har07 Aug 05 '15 at 10:46

1 Answers1

0

This xpath //span[contains(@class,'a b')]" looks for a span with class that contains substring "a b". f.e. <span class="ba ba"></span> or <span class="a b"></span> But if your want to get span with class "a" or class "b" should use //span[@class="a" or @class="b")]

dmr
  • 506
  • 2
  • 7