I have a Test which search for . On a previous level I have a fieldset which contains several values. Here is my problem. I don't get the locator for this fieldset.
First of all I get a list with all class=legend objects:
List groupList = driver.findElements(By.className("legend"));
This works perfectly, I have a list with several Webelements.
Now I want to iterate this list and save every value from the fieldset of the previous level only. The problem is that Selenium does not find the id of the fieldset.
I tried tempGroupElement.getAttribute("id") to get the id but it does not work.
Any idea?
Thanks!
解决方案
I have a method for this in C#.
public static IWebElement GetParent(IWebElement e)
{
return e.FindElement(By.XPath(".."));
}
Hope it helps :)