I'm looking for the right xpath syntax to get a specific parent of an element. Example:
root
|- div
| |
| |----??? ---|
| | |-a [class=1]
| | |- text[ A TEXT I DON'T WANT]
| |
| |
| |
| |-text[THE TEXT]
|
|-div
| |-text[THE TEXT I DON'T WANT]
|
|-div
| |-text[THE TEXT I DON'T WANT]
I want to get the text "THE TEXT" but the one that contains a [class=1]
inside the same div. Something like this:
//div//a[@class=1]/text[contains(.,'A TEXT')]/parent::*/parent::*.... <till div element> /text