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");
if (processes.Length == 0)
application = Application.Launch(@"someapplication");
else
application = Application.Attach(@"someapplication");
happy coding
Or easier
Application application = Application.AttachOrLaunch(@"someapplication.exe");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With