uniquely identify an java application instance

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
Prad
Posts: 12
Joined: Tue Feb 21, 2012 11:50 pm

uniquely identify an java application instance

Post by Prad » Wed Oct 24, 2012 3:44 pm

Hi ,

Is there a way to uniquely identify an instance of an application ?

if there are multiple instances of the application started and all of them
have the same set of UI elements and match the objects in the repository

though the actions are performed on the object that has focus ,

Just wanted to know if there is any way to uniquely identify the instance
of the application and set focus to it when operations/actions are required to be
performed on a specific application instance ?

Regards,
Prad

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: uniquely identify an java application instance

Post by Support Team » Fri Oct 26, 2012 11:39 am

Hi,

You could use the Index, the Instance attribute or the ChildIndex attribute in the root element of your application.

Regards,
Markus
Ranorex Support Team
.
Image

Prad
Posts: 12
Joined: Tue Feb 21, 2012 11:50 pm

Re: uniquely identify an java application instance

Post by Prad » Fri Oct 26, 2012 9:43 pm

Thanks ,

I see that but still did not come across a method to set focus to a particular instance of the application
from the test case code

would like to be able to do something like this

repo.Form.Activate( instance_1 )

perform operations

repo.from.Activate(instance_2)


Regards,
Prad

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: uniquely identify an java application instance

Post by Support Team » Mon Oct 29, 2012 11:09 am

Hi,

This is not possible this way.
The distinction whether it is instance 1 or 2 takes place in the RxPath of the form element.
For instance if there are two instances of the calculator running, one form is identified with the RxPath "/form[@title='Calculator' and @processname='calc' and @class='CalcFrame' and @instance='0']" and the second one with "/form[@title='Calculator' and @processname='calc' and @class='CalcFrame' and @instance='1']".
You can see that the instance attribute is used to uniquely identify the two forms.
In order to bring one of the forms in foreground you have to use the related repository item:
var calculator = repo.Calculator.Calculator;
var calculator1 = repo.Calculator1.Calculator;
// you can whether use EnsureVisible or Activate
calculator.EnsureVisible();
calculator1.Activate();
If you just want to use one repository item for each of the forms you could also use a repository variable and the data driven approach to distinguish between the instances and to perform the actions on a specific instance of your application.

There is also a method of the "Form" adapter which allows you to get the active state of the form:
bool isActive = calculator.Active;
, for more information please take a look at the API documentation of the Form adapter: Form Class.

Regards,
Markus
Ranorex Support Team
.
Image