How to find xpath for element using another dynamic element

Yeah, this one is a different page and different table which contains a tags…I realized my mistake…Can you suggest me a good article where i can learn these things :slight_smile:

Here are some links for learning xpath:

1 Like

Thanks dear, this looks very helpful :slight_smile:

Are xpaths contains and preceding-sibling usable for mobile app ios ?
If so, how do I use it? I tried your suggestion but it didn’t work

This post says that xpath is available for mobile ios.

Below is a snippet of the HTML of this page.

The <div>s with the class, “post-info post-date” and “read-state read” are siblings–the top one is preceding the bottom one and the bottom one is following the top one. So, to go from the bottom one to the span that is just under the top one (I did not include it), you could use:
//*[contains(@class, "read-state")]/preceding-sibling::div/span

Edit: You would likely have to clarify the above pathway further as there may be several within this thread.

The xpath you mentioned in the link is rarely used, it is just a relative xpath
What I want is to use “contains text” combined with “sibling”, but it doesn’t work on apps for both Android and iOS


I’m trying to press the “Remove” button, and there are a lot of them on the page. The text “7WUU28A4” is the key so I can press correctly