java - XPath contains returning IndexOutOfBounds Exception -


i new xpath. following piece of code checking ? check both these class "a b" when retrieving span elements.

htmlspan resultsspan =  (htmlspan) page.getbyxpath("//span[contains(@class,'a b')]").get(0); 

thanks

this xpath //span[contains(@class,'a b')]" looks span class contains substring "a b". f.e. <span class="ba ba"></span> or <span class="a b"></span> if want span class "a" or class "b" should use //span[@class="a" or @class="b")]


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -