Muhammad Omar Farooq Muhammad Omar Farooq - 8 months ago 54
C# Question

How do White work on already running application?

I am using testStack/White library to automate an application. Right now its working fine but it throws exception if the application is already running. Is there any way to put a check e.g if application is already running then do not invoke it. i mean, then we can skip this line of code

Application application = Application.Launch(@"someapplication.exe");

I could not find any good documentation of White.
Any help will be appreciated.


you could do:

Application application;
Process[] processes = Process.GetProcessesByName(@"someapplication.exe");
if (processes.Length == 0)
  application = Application.Launch(@"someapplication.exe");
  application = Application.Attach(@"someapplication.exe");

happy coding