When I try to use
var element = webdriver.FindElementByXPath("/");
or
var elements = webdriver.FindElementsByXPath("/");
I expect to get the root element(s) of my document.
What I get instead is an InvalidSelectorException with this message.
"invalid selector: The result of the xpath expression "/" is: [object HTMLDocument]. It should be an element. (Session info: chrome=50.0.2661.102) (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 10.0 x86_64)"
Why? Is there some way of getting that HTMLDocument
object or as I initially wanted, the root element(s)?
Isnt the xpath /
the root element (instead of document)?