I have many objects in one page which xpath is:
//td[@class=’bxec-day’ or @class=’bxec-day bxec-holiday’ and not(@class=’bxec-day bxec-day-past-hol’)]//div//div//a[text()=’10’]
they differ only by text in the last “a”:
a[text()=’5′]
a[text()=’6′]
etc.
i don’t need to click on “a” but i neet to make click on next to the last or last div.
construction like this //td[@class=’bxec-day’ or @class=’bxec-day bxec-holiday’ and not(@class=’bxec-day bxec-day-past-hol’) and @text()=’10’] doesn’t work.
Is it possible to go one or two level up in xpath? Or maybe there is some other solutions?
.. is probably what you need. So in your example:
//td[@class=’bxec-day’ or @class=’bxec-day bxec-holiday’ and not(@class=’bxec-day bxec-day-past-hol’)]//div//div//a[text()=’10’]/../../
This however goes up in a tree so if there are any other elements between ‘div’ and ‘a’ you need to take it into consideration.