IE 也是支持xpath的,只不过不是原生支持,是要加载wgxpath这个库去支持的。所以支持度没有其他浏览器那么好.
// Let the wgxpath library be compiled away unless we are on IE or Android.
// TODO: Restrict this to just IE when we drop support for Froyo.
if (goog.userAgent.IE || goog.userAgent.product.ANDROID) {
wgxpath.install(goog.dom.getWindow(doc));
}
或者可以参考这里: https://github.com/SeleniumHQ/selenium/wiki/Xpath-In-WebDriver