Unable to find locators for App Login - Xamarin.UI Automation test

161 Views Asked by At

As our app login page is upgraded from ADAL library to MSAL library. We are unable to find the locators(Automation IDs) for sign in option via Automation.

we tried

App.EnterText(“UserID”);
App.PressEnter();
App.EnterText(“Password”);
App.PressEnter();

but the value is not entering in user name field and got below Exception Exception: System.Exception: No keyboard is visible for text entry. at Xamarin.UITest.iOS.iOSApp+<>c__DisplayClass19_0.b__0 () [0x0002b] in <5c98084b260c4b7c9bafd9f653301be5>:0

Any suggestions to identify the user name field.

1

There are 1 best solutions below

1
Wendy Zang - MSFT On

You need to add Xamarin.UITest to the Xamarin.Forms solution first.

And Set the AutomationIdfor the Entry.

xaml:

 <Entry AutomationId="UserID" />
        <Entry AutomationId="Password" />

UITest:

 [Test]
    public void test3()
    {

        app.EnterText("UserID","5");//UserID is 5
        app.PressEnter();
        app.EnterText("Password","123456");//password is 123456
        app.PressEnter();

    }