I want to check if the AUT is opening a PDF viewer and I want to kill the process after test execution is finished. This is the relevant line of code:
Runtime.getRuntime().exec("taskkill /im AcroRd32.exe /f")
The test passes, but the Acrobat Reader is still open.
I thought the problem was that the cmd.exe
isn't authorized to kill the process form Katalon Studio so I've set it to always run as admin, as described here.
If I run the
taskkill /im AcroRd32.exe /f
directly from the command line, Acrobat Reader shuts down as expected, but it still remains open if run from the Katalon script.
How can I kill it?
This can help You, remember that arguments should be putetd in "" , "".
String[] arguments = {
// Arguments for program
}
ProcessBuilder pb = new ProcessBuilder(arguments);
pb.inheritIO();
Process process = pb.start();
process.waitFor();
pb.destroy();