How can I click the closest button of type X?

Ask general questions here.
Ewan C
Posts: 2
Joined: Wed Jun 29, 2022 12:40 pm

How can I click the closest button of type X?

Post by Ewan C » Wed Jun 29, 2022 12:53 pm

Hi,

I am using Ranorex to test a windows application. In this AUT, there is a canvas and you can drag and drop containers onto the canvas. Each container has a label with it's user given name and a Configure button.

So I now have say 3 containers spread out on the canvas and they are called "Container 1", "Container 2" and "Container 3".

I want to click on the Configure button for "Container 2". There are 3 identical Configure button though and Ranorex will click the wrong Configure button by default, even if I first move thye mouse to "Container 2", it will then click Configure on another Container.

So here is my question: If Move the mouse to "Container 2", can I then click on the Configure button that is nearest to the current mouse position or the nearest to the selected element? Does this require User Code or is there a simpler way to make Ranorex just do it?

I have experience of writting c# code in Selenium but if possible, I'd like a low code Ranorex solution if there is one...

ankit911omar
Posts: 12
Joined: Tue May 09, 2017 12:57 pm
Location: Mumbai, India
Contact:

Re: How can I click the closest button of type X?

Post by ankit911omar » Thu Oct 13, 2022 8:26 pm

Try to use the index , it will solve your issue.

Let's say you want use the second button then
Button [2]