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
  • 21,052
  • 22
  • 49
  • 55
prit kalra
  • 319
  • 4
  • 18
  • 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
  • 526
  • 2
  • 8