Page 1 of 1

Find an instance of an inner text and click it

Posted: Mon Apr 08, 2019 4:39 am
by Cyclops
Howdy all,

Just started playing with Ranorex and have hit my first real snag :) (I am not a programmer)

I am on a page and I would like Ranorex to search for a specific inner text, and click the button of the first instance it finds. I don't need a list.

I assume this is fairly easy, I just have no idea what I am doing :)

Thanks in advance!

Re: Find an instance of an inner text and click it

Posted: Mon Apr 08, 2019 11:24 am
by odklizec
Hi,

Could you please post a Ranorex snapshot (NOT screenshot) of the UI in question, so we can evaluate it and eventually suggest the best approach? Basically, you need to construct an xpath, which searches all element containing the inner text you are looking found and then simply add [1] at the end of xpath. Eventually, you can keep the xpath index-less, so Ranorex will always pick and use the first found element. But keep in mind that the first found element does not have to be always the same! So it's always best to construct xpaths, which find and return just one unique element.