Hi,
I've avoided making it too easy to generalised walks of the DOM with
webdriver because IME these tend to be abused, which why there's no
"getParent" method. Having said that, and in the spirit of making "the
hard things possible", there are two ways to get the parent node,
firstly be executing the following JS:
var e = arguments[0];
if (e['parentElement']) {
// Handles IE
return e.parentElement
}
// Walk the DOM until we find the parent
var p = e.parentNode;
while (p.type != 1) {
p = p.parentNode;
}
Using something like:
WebElement parent = (WebElement)
((JavascriptExecutor) driver).executeScript(
script, element);
Or, more simply:
WebElement parent = element.findElement(By.xpath(".."));
Cheers,
Simon
2009/8/21 Tomas <
tpoll...@gmail.com>: