TypeText only sends a few letters to TextBox

3 posts, 0 answers
  1. David
    David avatar
    21 posts
    Member since:
    Sep 2016

    Posted 20 Sep 2016 Link to this post


    I am quite new to Telerik and I am trying to set up automated tests for our WPF application. Whenever I try to use 'bar.User.TypeText("SomeText", 200)' to a framework element (found using 'FrameworkElement bar= foo.MainWindow.Find.ByAutomationId("New_Proj_Text_Box");') it sends a couple of letters to the TextBox, but then it cuts stops sending text.


    I think that this may be something to do with the window loading as the TextBox is in a Modal window and when you open the modal window mmanually (rather than using the link via Telerik) SendText sends all the text to to the TextBox.


    I have tried to introduce an "ensureClickable", changed the times for the "keyPressTime" and changing the clickFirst argument (trying both True and False). Unfortunately none of these seem to work.


    I have placed my test below. Unfortunately there are no helpful errors in the logs.


    Any help on this would be hugely appreciated.


    Many thanks in advance,





    using ArtOfTest.WebAii.Controls.Xaml.Wpf;
    using ArtOfTest.WebAii.Core;
    using ArtOfTest.WebAii.Silverlight;
    using ArtOfTest.WebAii.TestTemplates;
    using ArtOfTest.WebAii.Wpf;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    namespace UnitTestProject2
        /// <summary>
        /// Summary description for TelerikNUnitTest1
        /// </summary>
        public class TelerikNUnitTest1 : BaseWpfTest

            private TestContext testContextInstance;

            public WpfApplication foo { get; private set; }

            /// <summary>
            ///Gets or sets the test context which provides
            ///information about and functionality for the current test run.

            public void Open_Application()
                Settings mySettings = new Settings();
                mySettings.ClientReadyTimeout = 60000;

                /// Use my Settings object to construct my Manager object
                Manager myManager = new Manager(mySettings);

                // Launch the application instance from its location in file system
                WpfApplication fubar = myManager.LaunchNewApplication(@"C:\Users\e-ddcr\Documents\appLocation\Fubar.Startup.exe");

                /// Validate the title of the homepage
                //TestContext.WriteLine("Validated window");

                ///Click the new project button
                FrameworkElement newProjButton = fubar.MainWindow.Find.ByTextContent("New project...");

                ///Send keys to the project name textbox
                FrameworkElement projNameTextBox = fubar.MainWindow.Find.ByAutomationId("New_Proj_Text_Box");
                projNameTextBox.User.TypeText("PokeMoon", 100);



  2. David
    David avatar
    21 posts
    Member since:
    Sep 2016

    Posted 20 Sep 2016 in reply to David Link to this post

    I managed to fix this by using a 'projNameTextBox.Wait.ForNoMotion(5000);' before clicking the TextBox Element. Other 'Wait.For' methods did not seem to work.
  3. Georgi
    Georgi avatar
    364 posts

    Posted 21 Sep 2016 Link to this post

    Hello David,

    Usually when there is some animation playing or some other action that needs to be waited indeed Wait.ForNoMotion is the method to go to. Please note that you can set initial wait, time interval on which the framework to check if the element is in motion, and timeout like this:

    element.Wait.ForNoMotion(250, 250, 30000)

    Also here are some other tips that you might find useful:

       - When opening a new window (dialog as well) you might want to tap in to that window and search only in it by using the WaitForWindow method.

       - When searching you can use the generic find methods and pass the control type as parameter. This way you can work with the properties and methods that are specific to the control and are not present for the FrameworkElement class. For example instead of using Framewokrelement.User.TypeText method you can use TextBox.SetText method which provides more parameters for different needs. This is very helpful when working with RadControls as they would provide you with helpful suit of properties and methods like ComboBox SelectItem(string itemText, bool openDropDown) method.

    var combo = Application.Find.ByAutomationId<RadComboBox>(comboId);
    combo.SelectItem("PokeMoon item", true);

       - Use Refresh methods when needed. More information you can find here.
       - You might find helpful using Find.AllBy methods with LINQ:

    var menuItem= Application.Find.AllByType<RadMenuItem>().Where(item => item.TextBlockContent == "File").FirstOrDefault();

    Hope this would be helpful.

    Regards, Georgi
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top