Same app open and can't define which one to search element

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
xibinki
Posts: 28
Joined: Mon Jun 27, 2016 9:59 am

Same app open and can't define which one to search element

Post by xibinki » Wed Dec 28, 2016 4:12 pm

Hi Ranorex,

I'm having an issue while creating automated tests.
My scenario is this, I have the same app open but with different web services attached:
1. AppBO with ERP1
2. AppBO with ERP2

The operations that I'm doing are exactly the same on both apps, but when I perform a repository element .WaitForExists(), Ranorex can't establish in which app to search for that same element, example:
On "AppBO with ERP1" I open a window named "Window X" and the validation for WindowX.WaitForExists() works just fine. But if I leave "AppBO with ERP1" opened along with "Window X" also opened, when I switch to "AppBO with ERP2" and open the same "Window X", Ranorex doesn't WaitForExists() of "Window X", it simply tells me that "Window X" exists because it's already opened in "AppBO with ERP1".
The example might seem weird but it's exactly how I described... I'm making imports and exports on the same AppBO but with different ERP solutions.

Also, the AppBO opens with a different titlebar for each ERP, for example the titlebar for the ERP1 = "AppBO ERP1" and for the ERP2 the titlebar = "AppBO ERP2"

Is there a way to define on which app to search for the repository element (the element is the same on each application, because the application is AppBO)?

Hope to get back from you guys, thanks.

User avatar
RobinHood42
Posts: 238
Joined: Fri Jan 09, 2015 3:24 pm

Re: Same app open and can't define which one to search element

Post by RobinHood42 » Thu Dec 29, 2016 1:23 pm

Hi,

It seems the Ranorex path for both applications is the same.
Did you already try to change the Ranorex path to make the apps unique. If the path is unique Ranorex is able to recognize the correct instance.

Cheers,
Robin

xibinki
Posts: 28
Joined: Mon Jun 27, 2016 9:59 am

Re: Same app open and can't define which one to search element

Post by xibinki » Fri Dec 30, 2016 6:24 pm

RobinHood42 wrote:Hi,

It seems the Ranorex path for both applications is the same.
Did you already try to change the Ranorex path to make the apps unique. If the path is unique Ranorex is able to recognize the correct instance.

Cheers,
Robin
Hi, thanks for answering.

Well, the Ranorex path for both applications is in fact the same, because it's the same application opened twice. The difference is that on AppBO1 I associate a WebService1 and on AppBO2 I associate a WebService2.
AppBO1 = AppBO2 but WebService1 != WebService2.

And if I have Window1 opened in AppBO1, when I try to .WaitForExists(); for that exact same element, but now on AppBO2, it tells me that already exists but not in AppBO2 but in AppBO1.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Same app open and can't define which one to search element

Post by krstcs » Fri Dec 30, 2016 8:35 pm

You cannot have multiple instances of the same application open at the same time while running tests without making sure that the RanoreXPath for each application is DIFFERENT.

Ranorex ALWAYS finds the FIRST MATCHING ELEMENT for a given RanoreXPath. In your case it happens to be the first app.

The recommendation is to only run ONE instance of the AUT during a test. Otherwise you will get inconsistent results.

Edit to add: You can make the paths different by adding the Process Id (pid) to the XPath and capturing the actual pid at startup of the AUT using the Host class' RunApplication method, which returns the started application's pid. Your path would then look like: /form[@title='MyTitle' and @ProcessId=$pid]
Shortcuts usually aren't...