csharpgamer
csharpgamer

Reputation: 1

Test Stack White attach to app which does not show up in the task manager

I am working on an automated test and would like to perform actions on the windows event viewer. I have managed to open the event viewer through my test, but it does not attach to the app for me to make any actions like button presses/clicks as such.

The error showing is-

TestStack.White.WhiteException : Could not find process named: EventLog

Any help is appreciated, thanks in advance.

Upvotes: 0

Views: 148

Answers (1)

ojonasplima
ojonasplima

Reputation: 530

There is a lot of ways to attach the program you need, on your case you are using the Process Name property, that's not recommended since there can be a process with the same name. You have to always try to use the Id of the Process, like below:

Start the process with the directory info and than use the Id to get hold:

var applicationPath = Path.Combine(applicationPath, "foo.exe");
Application application = Application.Launch(applicationPath);  //Launch, Attach and Launch and Attach are used here
Window window = application.GetWindow("bar", InitializeOption.NoCache); //You can get the window with that or use some other property that use the Id of the application variable above.

Upvotes: 0

Related Questions