WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

Launching command line applications

Open PeteCarss opened this issue 9 months ago • 4 comments

Is it possible to launch a command line application?

I have tried various methods: Passing application path, Launching 'Terminal' and passing application path via send keys - WinAppDriver complains that it can't find a Handle to the application

PeteCarss avatar Apr 03 '25 10:04 PeteCarss

Please describe your scenario. It depends on your language. For c# you can run cmd command using Process.Start, then attach to it by process name or app name

/// <summary>
///     Execute cmd command
///     <param name="command">Command text</param>
/// </summary>
public static void ExecuteCommand(string command)
{
    var processInfo = new ProcessStartInfo("cmd.exe", "/K " + command)
    {
        CreateNoWindow = true,
        UseShellExecute = true
    };
    Process.Start(processInfo);
}

`

Shakevg avatar Apr 03 '25 18:04 Shakevg

I'm trying to run the command remotely either natively with Windows Application Driver, or via Appium - I'm agnostic to language at this stage, but have historical test code in Python

PeteCarss avatar Apr 04 '25 08:04 PeteCarss

You should use your language abilities or some script like bat or PowerShell, not WinAppDriver

Shakevg avatar Apr 04 '25 19:04 Shakevg

I second the comment from @Shakevg. Start the application using a batch file and then create a session on a opened window.

anunay1 avatar Apr 14 '25 08:04 anunay1