WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

Azure login screen

Open RSI-Repo opened this issue 5 years ago • 5 comments

To start, the way our login prompt is set up for WPF, Microsoft generates it and we have no real control/access for it. When running our automation tests we get this error 90% of the time "Failed to locate opened application window with appId". How can I get this resolved? WAD version 1.1.1809

RSI-Repo avatar Jan 22 '21 16:01 RSI-Repo

You need to create a root session and then switched to the opened window. check FAQ

anunay1 avatar Jan 25 '21 05:01 anunay1

@anunay1 We tried that, it didn't work.

RSI-Repo avatar Jan 27 '21 15:01 RSI-Repo

Are the elements shown in inspect.exe for login azure

anunay1 avatar Jan 27 '21 15:01 anunay1

Are the elements shown in inspect.exe for login azure

Yes they are showing. We ended up doing this for it to work. It's probably not a good way of going about this but it works: ` if (session == null)

{

try

{

// Start a new session by creating a new instance of the WindowsDriver object,

// we pass the WinAppDriver url and the appiumOptions parameters we created.

session = new WindowsDriver(new Uri(WindowsApplicationDriverUrl), appiumOptions);

curWindow = session.CurrentWindowHandle;

loginWindow = session.WindowHandles[0];

//System.Diagnostics.Trace.WriteLine("Application Window: " + session.CurrentWindowHandle + " Login Window: " + loginWindow + " Window Handle count: " + session.WindowHandles.Count());

}

catch(Exception ex)

{

   // Assert.IsNotNull(session);

   do

   {

     session = new WindowsDriver<WindowsElement>(new Uri(WindowsApplicationDriverUrl), appiumOptions);

      curWindow = session.CurrentWindowHandle;  

   }while(session == null);

}

}`

`[TestMethod]

    public void PrePopulated_Test()

    {          

        

        System.Diagnostics.Trace.WriteLine("PrePopulated_Test");

        if(session != null)

        {              

            // Click prepopulated account name

            // session.FindElementByName(fix.UserName).Click();                       

            loginTests.Login(fix.UserName, fix.PassWord, "loginWindow");

            session.SwitchTo().Window(session.WindowHandles[0]);            

        }

        else

        {

             Assert.Equals(session, null);

        }

                              

                 

    }`

RSI-Repo avatar Feb 10 '21 17:02 RSI-Repo

@anunay1 Now it doesn't work again. There doesn't appear to be a cure all fix for this.

RSI-Repo avatar Feb 26 '21 16:02 RSI-Repo