Check if an external program is run

Hi all
Is it possible to check if an external program runs?
When I click a ‘print’ button, my app opens a pdf reader. Is it possible to verify that the pdf reader is running.
And is it possible to check if the resulting pdf contains a certain text?

Hi Mate,

Great question… I’m going to need to do something similar at some point…

Is it possible to check if an external program runs?

Well, I’m not certain about this but if you’re using an external executor (Runtime.runtime.exec, for example) then I suspect the process returned will get you some information – maybe even the information you (we) require. I’m not an expert on any of this stuff but maybe somebody reading this is and will chime in with a fuller answer.

This was pasted directly from Katalon Studio – the formatting is suffering from the forum and javadoc not liking each other too much :wink:

Process java.lang.Runtime.exec(String command)

  • exec

    public Process exec(String command)             throws IOException
    

    Executes the specified string command in a separate process.

    This is a convenience method. An invocation of the form exec(command) behaves in exactly the same way as the invocation exec(command, null, null).

    Parameters:

    command - a specified system command.

    Returns:

    A new Process object for managing the subprocess

    Throws:

    [SecurityException](https://docs.oracle.com/javase/8/docs/api/java/lang/SecurityException.html) - If a security manager exists and its checkExec method doesn’t allow creation of the subprocess

    [IOException](https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html) - If an I/O error occurs

    [NullPointerException](https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html) - If command is null

    [IllegalArgumentException](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html) - If command is empty

    See Also:

    exec(String[], String[], File), ProcessBuilder

@Katalon Team

Seems editing of one’s own posts is broken…

image.png

@Russ Thomas

Thanks. However, this seems like a task a bit out of my league, for now. I had a chat with developers and for now we are leaving this test for manual testers.