Can I capture text from the command prompt in UFT? How could I capture text from the command prompt in UFT for validation purposes?
Asked
Active
Viewed 789 times
1 Answers
1
You can use the StdOut
property of the Exec
object to read text from the command window:
Set objShell = CreateObject("WScript.Shell")
sCommand = "ping 127.0.0.1"
Set objExecObject = objShell.Exec("cmd /c " & sCommand)
Do While Not objExecObject.StdOut.AtEndOfStream
sText = objExecObject.StdOut.ReadLine()
Loop
Replace the command text with your command, exactly how you would type it in the command prompt.
Take a look at extra examples in these questions:

Étienne Laneville
- 4,697
- 5
- 13
- 29