Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting WinAppDriver.exe programmatically

Before starting test execution, I have to manually start this WinAppDriver.exe.

I want to automate this task when I start executing my test cases it should start this exe and after finish it will close it.

I have tried in Java with below code but I'm not success:

Runtime runTime = Runtime.getRuntime();

String executablePath = "C:\\Program Files (x86)\\Windows Application Driver\\WinAppDriver.exe";

Process process = runTime.exec(executablePath);

Note: I required to run it with 'Run As Administrator'

like image 649
Kanti Avatar asked Sep 06 '25 10:09

Kanti


1 Answers

I would suggest using ProcessBuilder class from java as is it recommended to use it after Java 5 for starting/creating processes. Below code will start the WinAppDriver.exe :

String command = "C:\Users\Administrator\WinAppDriver\WinAppDriverTool\WinAppDriver.exe";
ProcessBuilder builder = new ProcessBuilder(command).inheritIO();
startWinAppDriver = builder.start();

Hope this helps.

like image 105
Sukhangad singh Avatar answered Sep 09 '25 18:09

Sukhangad singh