1

My application has a print document option that opens the pdf reader.

Is there a way to check if the pdf reader is running from Katalon?

1
  • 1
    Not sure why someone has voted to close as it's primarily opinion based... where's the opinion here? Is there a way to check if the .pdf reader is running from Katalon Studio or not? It sounds pretty black and white to me.
    – dvniel
    May 25, 2018 at 11:10

1 Answer 1

2

What about checking if the process is running by using a CustomKeyword ?

In your Keyword:

@Keyword
boolean processIsRunning(String processName) {

    def sout = new StringBuilder(), serr = new StringBuilder()
    def cmd = 'tasklist /FI "IMAGENAME eq ' + processName + '"'
    def proc = cmd.execute()
    proc.consumeProcessOutput(sout, serr)
    proc.waitForOrKill(1000)

    if(sout.indexOf(processName) < 0)
        return false;
    else
        return true;
}

In your TestCase (Script mode):

boolean process = CustomKeywords.'main.CheckProcess.processIsRunning'('explorer.exe')

if (process)
   KeywordUtil.markPassed("Process is running")
else
   KeywordUtil.markFailed("Process not running, test failed")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.