Find an instance of an inner text and click it

Ranorex Studio, Spy, Recorder, and Driver.
Posts: 4
Joined: Mon Apr 08, 2019 4:34 am

Find an instance of an inner text and click it

Post by Cyclops » Mon Apr 08, 2019 4:39 am

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!

User avatar
Ranorex Guru
Ranorex Guru
Posts: 7469
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

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

Post by odklizec » Mon Apr 08, 2019 11:24 am


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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration