Description
The WMI.WaitForProcessExit
method allows you to delay the test execution until a specific process running on a local or remote computer completes. The computer where the process execution will be monitored is specified by the WMI.ComputerName
property.
Declaration
WMI.WaitForProcessExit(ProcessName, Timeout)
ProcessName | [in] | Required | String | |
Timeout | [in] | Required | Integer | |
Result | None |
Applies To
The method is applied to the following object:
Parameters
The method has the following parameters:
ProcessName
The name of the process’s executable, including the extension. For example, notepad.exe. The name is case-insensitive.
Timeout
The timeout, in milliseconds, to wait until the specified process completes.
Result Value
None.
Remarks
If the specified process does not complete during the provided timeout, the method posts an error message to the test log.
Example
The following example starts iexplore.exe, performs some actions over the application and waits for 15 seconds for the application to exit. If it has not exited within 15 seconds, an error message is posted to the log.
JavaScript, JScript
// ...
WMI.ComputerName = ".";
WMI.CreateProcess("C:\\Program Files\\Internet Explorer\\iexplore.exe");
// Performs some actions over the application
WMI.WaitForProcessExit("iexplore.exe", 15000);
// ...
Python
# ...
WMI.ComputerName = "."
WMI.CreateProcess("C:\\Program Files\\Internet Explorer\\iexplore.exe")
# Performs some actions over the application
WMI.WaitForProcessExit("iexplore.exe", 15000)
# ...
VBScript
' ...
WMI.ComputerName = "."
Call WMI.CreateProcess("C:\Program Files\Internet Explorer\iexplore.exe")
' Performs some actions over the application
Call WMI.WaitForProcessExit("iexplore.exe", 15000)
' ...
DelphiScript
// ...
WMI.ComputerName := '.';
WMI.CreateProcess('C:\Program Files\Internet Explorer\iexplore.exe');
// Performs some actions over the application
WMI.WaitForProcessExit('iexplore.exe', 15000);
// ...
C++Script, C#Script
// ...
WMI["ComputerName"] = ".";
WMI["CreateProcess"]("C:\\Program Files\\Internet Explorer\\iexplore.exe");
// Performs some actions over the application
WMI["WaitForProcessExit"]("iexplore.exe", 15000);
// ...