I am trying to phrase a XPath which would look somewhat like this.
//div[@class='foo']/ancestor::(fieldset or div)[@class='foo1']
But XPath is not working at this point (fieldset or div)
A long XPath like the one below is working,
(//div[@class='foo']/ancestor::fieldset[@class='foo1'] or //div[@class='foo']/ancestor::div[@class='foo1'])
But, is there any concise way to build this XPath?