|
Run Method
Collapse All Expand All
Description
Runs a file or application.
Important Information
When specifying a non-executable file, the file opens in the associated application.
Note: A SystemUtil.Run statement is automatically added to your test when you run an application from the Start menu or the Run dialog box while recording a test.
Tip: You can also use this method to perform operations on the specified file, similar to the usage of the Windows ShellExecute command.
Syntax
object.Run file, [params], [dir], [op], [mode]
Syntax Details
Argument Description
object A test object of type SystemUtil.
file Required. A String value.
The name of the file you want to run.
params Optional. A String value.
If the specified file argument is an executable file, use the params argument to specify any parameters to be passed to the application.
dir Optional. A String value.
The default directory of the application or file.
op Optional. A String value. The action to be performed. If this argument is blank ( ""), the open operation is performed.
The following operations can be specified for the op argument: Operation
Description
open Opens the file specified by the FileName parameter. The file can be an executable file, a document file, or a folder. Non-executable files are open in the associated application.
edit Launches an editor and opens the document for editing. If the FileName argument does not specify an editable document file, the statement fails.
explore Explores the folder specified by the FileName argument.
find Initiates a search starting from the specified folder path.
print Prints the document file specified by the FileName argument. If the specified file is not a printable document file, the statement fails.
mode Optional. An Integer value.
Specifies how the application is displayed when it opens. You can specify one of the modes in the table below.
Default = 1
Mode
Description
0 Hides the window and activates another window.
1 Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. Specify this flag when displaying the window for the first time.
2 Activates the window and displays it as a minimized window.
3 Activates the window and displays it as a maximized window.
4 Displays the window in its most recent size and position. The active window remains active.
5 Activates the window and displays it in its current size and position.
6 Minimizes the specified window and activates the next top-level window in the Z order.
7 Displays the window as a minimized window. The active window remains active.
8 Displays the window in its current state. The active window remains active.
9 Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. Specify this flag when restoring a minimized window.
10 Sets the show-state based on the state of the program that started the application.
Return Type
None
Example
自己F1一下就可以了啊,比如我启动IE,打开网址:
SystemUtil.Run "iexplore.exe", "https://10.11.102.178", "", "Open", "3" |
|