0

I'm working on some automation testing for a test app I developed. Using Powershell, I need to identify if a certain instance of the application is running. Currently, I can only find out ways to determine if the Application itself is running, not a specific instance of the application.

For example, see picture below: Task Manager with Application

The "SDX Test App" is the application itself. From the picture, you can see there's two instance of the test app (the top one is an error popup dialogue).

I need a way through Powershell to detect if the "Assertion Failure" instance is running.

When I right click on that instance, there is no option for "Properties" or anything like that.

Does anyone have a method of checking this? It would be much appreciated!

1 Answer 1

3

You could try using the MainWindowTitle and/or CommandLine properties to differentiate between processes with the same name:

# List the different instances of notepad++
Get-Process -Name notepad++ | Select-Object ProcessName,MainWindowTitle,CommandLine
ProcessName MainWindowTitle        CommandLine
----------- ---------------        -----------
notepad++   C:\A\A.txt - Notepad++ "C:\Program File…"
notepad++   C:\B\B.txt - Notepad++ "C:\Program File…" "C:\B\B.txt"

From there you can write a basic test. For example:

# Check for assertion failure window:
if ( (Get-Process -Name "SDX Test App").MainWindowTitle -like "Assertion Failure*" ) {
  Write-Output "It's running!"
}
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for the response! This is an extremely clean and easy solution. I appreciate it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.