When testing for desktop apps, the login part is performed on the web. I got the login link but don’t know how to do the login part while on desktop testing.
Is there any way for me to do the above work?
Hi,
Thank you for sharing your concern. This is an interesting scenario, can you test by simulating Web Login? After getting login link, use Katalon Studio’s web testing capabilities to open the login URL in a separate browser window and perform the login steps using Katalon Studio’s web automation keywords like WebUI.sendKeys and WebUI.click to fill in credentials and submit the login. then switch back to Desktop App if possible.
Because the login link contains an accessToken that can only be created when clicking the Login button in the desktop app, there can be no login link if the desktop app has not been opened.
hi @cong11vn
since the token only exists after the desktop app opens the browser, you have to drive the browser the app opens, not one you open yourself. the trick is to make sure that browser is one katalon can attach to.
start chrome with a debugging port before the test (once, in a listener or a batch script):
chrome.exe --remote-debugging-port=9222 --user-data-dir=C:\katalon\chrome-profile
chrome is the default browser, so when the desktop app fires the login link it opens as a new tab in that same chrome instance. then attach katalon to it: in Project > Settings > Desired Capabilities > Chrome add debuggerAddress string localhost:9222, call WebUI.openBrowser(‘’) and switch to the tab with the login url (WebUI.switchToWindowUrl or by index). fill the form with the normal WebUI keywords, and once the app receives the token continue with the Windows keywords. the two drivers live side by side in the same test case, nothing special needed.
if you cannot set chrome as default on the test machine, the fallback is to automate the login page through the windows driver itself: chrome’s window is in the ui automation tree, so Windows.startApplicationWithTitle on the chrome window and setText on the edit controls works, it is just slower to locate objects.
- As far as I know, Chrome forwards a new link to the running instance using the same user-data-dir. A link fired by the OS default-browser handler normally goes to the default profile, while the debug instance runs from
C:\katalon\chrome-profile, so the login URL may open in a different Chrome than the one Katalon is attached to. Recent Chrome versions also ignore--remote-debugging-porton the default profile, so you can’t just use that. Worth confirming which window the link actually opens in. - A more reliable option may be to read the login URL the app opened (e.g. from the browser’s address bar via the Windows keywords) and open that URL in a Katalon-controlled browser with WebUI. If the token only works in the browser that received it, use fallback given above by Depa and fill the form through the Windows driver.
If debuggerAddress has no effect as a plain capability, try it inside goog:chromeOptions
If the app gets the token back via a custom-protocol link, the browser may show an “open app?” prompt that also needs handling.