cancel
Showing results for 
Search instead for 
Did you mean: 

Capturing the Command Line of a Process running in the Task Manager

SOLVED
nedbacan
Contributor

Capturing the Command Line of a Process running in the Task Manager

I don't know if this test is possible but I would like to ask the experts if it can be done.

 

Using TestComplete, is there a way to capture the command line of a process that appears in the Task Manager.

 

When a certain task (double click on a link) in the web application is called,  I would like to verify the process for that task has the correct command line and then copy it to the log result.  The process remains visible in the task manager for about 10 seconds before it gets cleared.

 

Is there a Javascript method that will do this without launching the task manager? 

 

nedbacan_0-1611021057580.png

 

Thank you !!!

 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
tphillips
Community Leader

Re: Capturing the Command Line of a Process running in the Task Manager

One way to do that is using PowerShell

 

gwmi win32_process | select commandline, name | format-list

 

 I am sure you can massage the data a little better and use a filter to just find "httpd.exe".


--------------------
QA Systems Architect

View solution in original post

BenoitB
Community Hero

Re: Capturing the Command Line of a Process running in the Task Manager

The simplest way is to use the builtin functions.

 

let n = "TestComplete";
let p = Sys.Find("ProcessName", n);
p.Exists ? Log.Message(p.CommandLine) : Log.Message("Process " + n + " not found !");

 

Or if the process to check is always the same :

Sys.Process("TestComplete").Exists ? Log.Message(Sys.Process("TestComplete").CommandLine) : Log.Message("Process not found !");

 

Un sourire et ça repart

View solution in original post

16 REPLIES 16
tphillips
Community Leader

Re: Capturing the Command Line of a Process running in the Task Manager

One way to do that is using PowerShell

 

gwmi win32_process | select commandline, name | format-list

 

 I am sure you can massage the data a little better and use a filter to just find "httpd.exe".


--------------------
QA Systems Architect

View solution in original post

BenoitB
Community Hero

Re: Capturing the Command Line of a Process running in the Task Manager

The simplest way is to use the builtin functions.

 

let n = "TestComplete";
let p = Sys.Find("ProcessName", n);
p.Exists ? Log.Message(p.CommandLine) : Log.Message("Process " + n + " not found !");

 

Or if the process to check is always the same :

Sys.Process("TestComplete").Exists ? Log.Message(Sys.Process("TestComplete").CommandLine) : Log.Message("Process not found !");

 

Un sourire et ça repart

View solution in original post

tphillips
Community Leader

Re: Capturing the Command Line of a Process running in the Task Manager

Oh wow @BenoitB I didn't realise the Process object had those properties like that. That's way better than my answer!


--------------------
QA Systems Architect
BenoitB
Community Hero

Re: Capturing the Command Line of a Process running in the Task Manager

@tphillips this is the problem with TC, so rich that everyday you discover something 😜

Un sourire et ça repart

nedbacan
Contributor

Re: Capturing the Command Line of a Process running in the Task Manager

Hello @BenoitB , I appreciate for providing me with the process check sample.  Great !!  

 

I modified the script to look for the process that needs to be capture but it returns "Process octDataParser not found !' but when I placed back "TestComplete" it returns with the process command line for TestComplete. 

 

Is there something I am changing wrong or missing to add?

 

function ProcessFinder()
{
let n = "octDataParser_core.exe";
let p = Sys.Find("ProcessName", n);
p.Exists ? Log.Message(p.CommandLine) :
Log.Message("Process " + n + " not found !");
}

 
 

octParser.png

 

BenoitB
Community Hero

Re: Capturing the Command Line of a Process running in the Task Manager

Use the Name property that you see in Object browser, typically it's name without '.exe'

Un sourire et ça repart

nedbacan
Contributor

Re: Capturing the Command Line of a Process running in the Task Manager

@BenoitB , sorry but no luck in getting the name =(. 

 

I checked the Object Browser and the process name is not listed.

 

So I used the Object Spy to see if I can get the name (see shot).  Is confusing it has UIAObject("Name").

 

Note, in order to get the process to appear I must click to open an image in the software then the process would run for about 10 seconds and then clears out.  

 

nedbacan_0-1611289374993.png

 

nedbacan_1-1611289652463.png

nedbacan_2-1611289720114.png

 

 

 

 
 

 

 

 

 

BenoitB
Community Hero

Re: Capturing the Command Line of a Process running in the Task Manager

So, your need is to find the command line of a process which is launched only when you click on an image ?

 

In your test you do :

- click image

- check process only as this moment

 

About the confusing name that you have, it's normal, what you see here is not the process but the ihm component showing the process name in the task manager. This is not the process name.

 

To obtain the real name when your looking into taskmanager, scroll down on object spy inspector to find the Value, try with the value found without the .exe.

See the gif file attached.

 

Un sourire et ça repart

nedbacan
Contributor

Re: Capturing the Command Line of a Process running in the Task Manager

@BenoitB , I followed your steps and for some reason, the process "octDataParser still not being captured by TestComplete.  

What other options can I take or do you see the problem.  I had attached a video of my steps.

 

Thank you for your support. 

New Here?
Join us and watch the welcome video:
Top Kudoed Authors