From long time I search a solution to recognize element near other elements, after long researches I found some special xpath to do this it are xpath axes
I want to store my date post knowing my username in the forum how i can create a correct xpath to do this ?
Seems a simple scrape but I have not a fixed part to recognize the dates to store, I know my username, after i must store the date post.
Any suggestion please ?
I want to know these special xpath to detect element near others element
if
i//article[@id=‘post_1’]//a[contains(text(),‘newuserkantu’)]
is true then store the value of
xpath=//*[@id=“post_1”]/div/div[2]/div/div[2]/div/a/span
You should be able to do this just using a bunch of if conditionals but I checked my selector finder ChroPath and I don’t see anything about xpath axes. Maybe you can make a feature request with them
This is really a tricky challenge. On other websites “sourceExtract” plus some Regex can work, but on modern websites like this “Discourse” forum, the page source code is a mess full of Javascript.
If I had to do it, I would go for relative extraction and screen scraping (OCRExtractRelative command).
However, if anyone has an XPath solution I would be interested in this, too