Hi,
I am trying to check how many instances of an application (Adobe Reader) that is running.
Let's say I assume that there will be 3 Adobe Reader's open. To check that the 3rd one is open, I can do the following:
Validate.Exists("/form[@title='Report' and @processname='AcroRd32' and @class='AcrobatSDIWindow' and @instance='2']");]
However, this way I have to know the largest instance number. What I rather need to do, is to get a count of the number of instances. Or get the largest instance number that exists for that process. Same thing
Ideas?
Thanks
Verify how many instances of an application is running
Re: Verify how many instances of an application is running
Code: Select all
iList<Ranorex.Form> apps = Host.Local.Find<Ranorex.Form>("/form[@processname='AcroRd32']);
Report.Info("Instance count = " + apps.count.ToString());
Re: Verify how many instances of an application is running
Worked like a charm, thank you. Didn't know I could use IList that way.
- artur_gadomski
- Posts: 207
- Joined: Mon Jul 19, 2010 6:55 am
- Location: Copenhagen, Denmark
- Contact:
Re: Verify how many instances of an application is running
I would use System.Diagnostics.Process.GetProcessesByName() (http://msdn.microsoft.com/en-us/library/z3w4xdc9.aspx) rather than Ranorex version. unless of course you need to do something with those forms.
Re: Verify how many instances of an application is running
Thank you for your post, but I just open task manager and see it.