WinAppDriver - Windows app is launch with additional login screen and I am unable to switch on the login screen

410 views Asked by At

When I launch my windows application, it is launched with two different screens i.e. one is application and one is login window.

By default, it remains on the main application and I am unable to switch to the login window.

When I am trying to locate an element using Appium Desktop, it captures only the main application but unable to load/switch the login window too. So I am also facing locating elements.

It would be great if someone gives some idea about switching windows and locating elements.

Thanks,

1

There are 1 answers

0
Schmebi On

Switching windows works the same like in Selenium, I will make this example in C#.

driver.WindowHandles.Count gives you the amount of windows of the application, so if you don't know what index your window has, you try to switch through all of them.

for (int i = 0; i < driver.WindowHandles.Count; i++)
{
    driver.SwitchTo().Window(driver.WindowHandles[i]);
}

You can also get the page source with driver.PageSource of the current window if you don't find the element in the inspector.