Switch To Window belongs to another Application

Hi, I am using Katalon studio 8.6.5.

The desktop application I am testing now is having this function of after clicked on an icon, it would save a PDF file to my local drive, and then open the PDF file in a new browser (Google Chrome) window.
I am able to use Katalon to click the pdf icon so that to open the chrome window with the PDF. However, I am struggling to find a way to switch to the Chrome window to continue perform any action on the PDF. Please suggest if there is anyway for Katalon to jump from testing application to another window belongs to other application. I have tried Windows.startApplicationWithTitle and Windows.switchToWindowTitle it seems not work for such case.

Hi,

I will take a look and find workaround soon

hi @zhijia_wu

a winappdriver session started with startApplication(exe) only sees windows of that process, which is why the chrome window is out of reach. open a second session on the desktop root instead, that one spans every top level window on the machine:

Windows.startApplication('Root')
Windows.switchToWindowTitle('report.pdf - Google Chrome')

from there you can click the pdf viewer toolbar, send ctrl+s, read the title and so on, and switchToWindowTitle back to your app when done. the root session also works in object spy, pick “Root” as the application.

that said, chrome’s pdf viewer exposes almost nothing to ui automation, the text is not in the tree. since the app already writes the pdf to disk, the sturdier check is the file itself: wait for it to appear in the download folder, then read it with pdfbox (the jar ships with katalon) and assert on the text. that removes the chrome window from the test entirely.