Is there any way to collect multiple titles when they all have unique xpath ids with no numbered increments

as the title suggests, I was trying to make a macro which would copy the titles from reddit. However, reddit unlike duckduckgo or google, does not have +1 incriment with each title. Its xpath does not change, only the id="t_xxxxxxx" is always unique.

Example of 3 titles from a list I wanted to grab:

xpath=//*[@id="t3_141j5kw"]/div[3]/div[2]/div/a/div/h3
xpath=//*[@id="t3_141bcuf"]/div[3]/div[2]/div/a/div/h3
xpath=//*[@id="t3_141i3jy"]/div[3]/div[2]/div/a/div/h3

Theyr’e all random, I was thinking to use ‘contains’ for a partial match but it will not collect the titles in a list type manner, I would need to generate random letters/numbers. Could maybe do something with regex here but yea still can’t put it together. Does anyone have any ideas how this could work? Thanks!

P.s. I know regex with sourceExtract would probably work but only the visible part of the page would get extracted. I want it to scroll/loop until satsified number of titles was collected. Please advise, thank you

How do you find all the titles? Are these inside one HTML page? If so, then the @pos=X attribute might help you to loop over all of them.

1 Like

I was able to get it by full Xpath copying through Chrome

/html/body/div[1]/div/div[2]/div[2]/div/div/div/div[2]/div[*]/div[1]/div[5]/div[3]/div/div Like this, then only the last changes and goes +1, some others change too but simply adding * to replace it works now like a charm!