app.EnterText() doesn't work on some Android devices on Test Cloud RRS feed

  • Question

  • User272997 posted

    It throws "System.TimeoutException : Timed out waiting for keyboard to be shown."

    Why is that?

    It works on most devices, but on some it doesn't.

    I use it like this for example - app.EnterText("passwordEntry", "password"), where "passwordEntry" is my EditText field

    I see that it taps on correct coordinates, but then for some reason it can't enter the text

    When I test it on emulator or on my physical devices, everything is fine.

    Is there a solution or a workaround for this?

    I tried app.Query(e=>e.Marked("passwordEntry").Invoke("setText", "password")) but it doesn't work either

    Monday, March 20, 2017 11:41 AM

All replies

  • User122866 posted

    I know on some older phones there can be a delay in bringing up the keyboard.

    Perhaps try adding a Thread.Sleep(2000) after you "tap" the control?

    Also, check out the following link for other tips on Timeouts & Waiting - https://developer.xamarin.com/guides/testcloud/uitest/working-with/timeouts/

    Monday, March 20, 2017 1:14 PM
  • User272997 posted

    The devices are brand new with Android 7.0+ ;)

    I tried what you suggested and it still doesn't work

    For some reason, the EditText field doesn't react to app.Tap() on some devices, and that's why the keyboard doesn't come up

    Examples of such devices are:

    Google Pixel (Android 7.1.1) LG Nexus 5X (Android 7.0) LG Nexus 5X (Android 7.1.1) LG Nexus 5X (Android 6.0.1)

    Monday, March 20, 2017 2:29 PM
  • User122866 posted

    Interesting, let me dig a little deeper.

    1. Can you please ensure you are running with the latest packages and updates?

    2. Looking over this Android/Test Cloud sample for EditText, it seems pretty straight forward.

      • Layout - https://github.com/xamarin/test-cloud-samples/blob/master/android/BackdoorActivity/App/Resources/layout/second_activity.axml#L15-L20
      • Test - https://github.com/xamarin/test-cloud-samples/blob/master/android/BackdoorActivity/UITests/Tests.cs#L49-L54
    Monday, March 20, 2017 3:07 PM
  • User272997 posted

    I have slightly modified the tests in your sample app to look like this:

    using System.Linq;
    using NUnit.Framework;
    using Xamarin.UITest;
    using Xamarin.UITest.Android;
    namespace BackdoorActivity.UITests
        public class Tests
            AndroidApp app;
            public void BeforeEachTest()
                app = ConfigureApp
            public void Click_button_for_second_activity()
                // Arrange
                app.WaitForElement(c => c.Marked("button1"));
                app.Tap(c => c.Button("button1"));
                // Act 
                EnterTextOnActivityTwo("Text #1");
            void EnterTextOnActivityTwo(string text)
                app.WaitForElement(c => c.Marked("editText2"));
                app.EnterText(c => c.TextField("editText2"), text);

    and I ran this test on Test Cloud on the 4 devices I mentioned in post #3, and on all devices with Android 7.0+ the EditText field remains empty, even though there was supposed to be "Text #1" text inside it

    On Android 6.0.1 everything was correct and the text was there

    You can check for yourself

    It looks like a bug in Xamarin

    Monday, March 20, 2017 4:13 PM
  • User122866 posted

    Interesting, I was able to run the XTC sample linked above in emulation as well as on 3 separate 7.1.1 devices (Google Pixel, Google Pixel XL, Huawei Nexus 6P)

    Attached below is my full sample app: - Version Info - https://gist.github.com/mattregul/f900414c42e98098ff058f4c567100da#file-version-info - Screenshots - https://gist.github.com/mattregul/f900414c42e98098ff058f4c567100da#gistcomment-2032313 - Latest Android SDK Updates - Latest Xamarin Updates (current stable branch) - UITest 2.0.7


    I was wondering if you could provide a bit more info:

    1. Could you please try running my attached sample?

    2. Are you working on Windows or Mac OS?

    3. Version information from the appropriate IDE https://kb.xamarin.com/customer/portal/articles/1675684-how-to-collect-version-information-and-logs

    4. Logs from the appropriate IDE https://kb.xamarin.com/customer/portal/articles/1675684-how-to-collect-version-information-and-logs


    Monday, March 20, 2017 6:06 PM
  • User272997 posted
    1. I can't even build your sample. I get Could not determine API level for $(TargetFrameworkVersion) of 'v7.1' error in BackdoorActivity project, even though I have Android 7.1.1 (API 25) SDK Platform installed

    2. I'm working on Windows (Xamarin for Visual Studio)

    3. Version information:

      Microsoft Visual Studio Professional 2015 Version 14.0.25431.01 Update 3 Microsoft .NET Framework Version 4.6.01586

      Installed Version: Professional

      LightSwitch for Visual Studio 2015 00322-40000-00000-AA491 Microsoft LightSwitch for Visual Studio 2015

      Visual Basic 2015 00322-40000-00000-AA491 Microsoft Visual Basic 2015

      Visual C# 2015 00322-40000-00000-AA491 Microsoft Visual C# 2015

      Visual C++ 2015 00322-40000-00000-AA491 Microsoft Visual C++ 2015

      Application Insights Tools for Visual Studio Package 1.0 Application Insights Tools for Visual Studio

      ASP.NET and Web Tools 2015.1 (Beta8) 14.1.11107.0 ASP.NET and Web Tools 2015.1 (Beta8)

      ASP.NET Web Frameworks and Tools 2012.2 4.1.41102.0 For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

      ASP.NET Web Frameworks and Tools 2013 5.2.40314.0 For additional information, visit http://www.asp.net/

      Command Bus, Event Stream and Async Manager Merq Provides ICommandBus, IEventStream and IAsyncManager MEF services for loosely coupled Visual Studio extension components communication and integration.

      Common Azure Tools 1.8 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

      JavaScript Language Service 2.0 JavaScript Language Service

      JavaScript Project System 2.0 JavaScript Project System

      Microsoft Azure Mobile Services Tools 1.4 Microsoft Azure Mobile Services Tools

      NuGet Package Manager 3.4.4 NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

      PreEmptive Analytics Visualizer 1.2 Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

      SQL Server Data Tools 14.0.60519.0 Microsoft SQL Server Data Tools

      TypeScript TypeScript tools for Visual Studio

      Xamarin (fa989ec) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

      Xamarin.Android (ce955cc) Visual Studio extension to enable development for Xamarin.Android.

      Xamarin.iOS (e02d272) Visual Studio extension to enable development for Xamarin.iOS.

    4. IDE Logs are attached below

    Tuesday, March 21, 2017 9:44 AM
  • User122866 posted

    It looks like you are a version behind with Xamarin.Android, leading to the tooling not recognizing 7.1.

    Can you please try updating your Xamarin.Android to the latest? (I believe the current version is (9578cdc)) 1. Run Visual Studio (may need to run as administrator) 2. Click Tools >> Options >> Select Xamarin on the left >> Select Other >> click Check Now

    Wednesday, March 22, 2017 3:38 PM
  • User272997 posted

    Ok, I have updated Xamarin to the latest version like you said but now I have another problem - "Run in Test Cloud" option has disappeared from the context menu when I right-click the .UITests project

    And I can't even run the tests locally, because I get "ApkFile or InstalledApp has not been configured" exception, even though the app IS installed on the emulator

    Sometimes when I rebuild the UITests project, the test cases don't even appear in the Test Explorer

    Wednesday, March 22, 2017 4:44 PM
  • User122866 posted

    Yeah, that is unfortunately one of our current bugs
    - https://forums.xamarin.com/discussion/89643/run-in-test-cloud-contextmenu-has-disappeared#latest - https://bugzilla.xamarin.com/show_bug.cgi?id=51524

    Until this is fully addressed, you may need to upload via command line - https://developer.xamarin.com/guides/testcloud/uitest/working-with/submitting-tests-at-command-line/

    Wednesday, March 22, 2017 6:50 PM
  • User272997 posted

    Ok, I have managed to run your app on Test Cloud through the command line. I ran it on 4 devices:

    Google Pixel (Android 7.1.1) Google Pixel XL (Android 7.1.1) Huawei Nexus 6P (Android 7.1.1) LG Nexus 5X (Android 7.1.1)

    And the results are:

    "Click Button For Second Activity" test has passed on all devices (so the EditText field was filled)

    "Use Backdoor For Second Activity" test has failed on all devices with "System.Exception : Error while performing Invoke("StartActivityTwo", null) ----> System.Exception : Invoke for StartActivityTwo failed with outcome: ERROR No such method found: StartActivityTwo()"

    However, in MY app, the EditText fields are STILL not getting filled on some phones, even after Xamarin update. These phones are:

    Google Pixel (Android 7.1.1) LG Nexus 5X (Android 7.1.1) LG Nexus 5X (Android 7.0) LG Nexus 5X (Android 6.0.1)

    Thursday, March 23, 2017 11:22 AM
  • User273637 posted

    I am also having trouble with using the backdoor Invoke() method.

    Invoking with no parameter works fine: app.Invoke("YourBackdoorMethod");

    But running with an extra parameter causes all tests to fail locally and in XTC: app.Invoke("YourBackdoorMethod", "StringParameter");

    Both work fine on iOS.

    Thursday, June 1, 2017 5:19 PM
  • User331661 posted

    I am having the same issue, I deploy the project into the real devices. For the old devices Android V.4.4.4 it is working fine but for the Android 6.0 and above it doesn't work.

    app.EnterText(x => x.Class("SystemWebView").Css("INPUT#adminpassword"), strAdminPwd);

    It is a bug in Xamarin? Thanks

    Monday, July 24, 2017 6:53 AM
  • User331518 posted

    I have the same issues on Samsung Galaxy S7 (7.0) and Samsung Galaxy S8 (7.0)

    Tests are passing on Samsung Galaxy S6 Edge (5.0.2) and Samsung Galaxy S5 (4.4.2)

    This error is happening on app.EnterText()

    Friday, August 25, 2017 6:42 PM
  • User331661 posted

    Is @Microsoft working on this issue? Look like it has been pending for many months.


    Monday, August 28, 2017 9:16 AM
  • User316762 posted

    Hi Any updates?

    Monday, October 16, 2017 2:01 PM
  • User292698 posted

    Same issue here. Anyone resolved it?

    Sunday, February 4, 2018 4:24 PM