TypeText not firing events for autosuggest

5 posts, 1 answers
  1. Wit
    Wit avatar
    24 posts
    Member since:
    Jul 2010

    Posted 26 Aug 2010 Link to this post

    Here is sample test:
    [Test]
            public void GoogleTest()
            {
                ActiveBrowser.NavigateTo("http://www.google.com");
                ActiveBrowser.WaitUntilReady();
                 
                HtmlInputText queryBox = Find.ByName<HtmlInputText>("q");
                Desktop.Mouse.Click(MouseClickType.LeftClick, queryBox.GetRectangle());
                Desktop.KeyBoard.TypeText("sample", 1000);
                 
                Actions.Click(Find.ById("btnG"));
            }

    By watching its execution you'll notice that Google autosuggest is not visible during TypeText execution.
    When typing manually autosuggest appears immediately.

    Why TypeText works differently? How to force opening autosuggest?

  2. Wit
    Wit avatar
    24 posts
    Member since:
    Jul 2010

    Posted 27 Aug 2010 Link to this post

    I found some workaround for this:

    Desktop.KeyBoard.TypeText(" ",0);
    Desktop.KeyBoard.KeyPress(Keys.Back);

    It appears that KeyPress works much better thna TypeText i.e. actual keystrokes are sent.
    Why is TypeText not doing the same?
  3. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 02 Sep 2010 Link to this post

    Hello Wit,

    Yes, I can confirm these methods behave in a different manner. The TypeText initiates KeyPress to the browser and KeyPress - KeyDown and Up events. The Google auto suggest definitely needs the KeyDown/Up to be triggered thus the behavior. I'm not sure why KeyPress itself doesn't make the auto suggest to popup for the Google search page though, this might be expected.

    I'm logging a bug for investigation just in case. I can update this thread with our findings if needed.

    Kind regards,
    Konstantin Petkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  4. Answer
    Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 14 Sep 2010 Link to this post

    Hi Wit,

    Good news here! I just verified the TypeText method has been improved in the latest build so that for example it now triggers the auto complete box on google.com. You can find the build available for download from the latest internal builds page in your account.

    Your feedback is appreciated!

    Kind regards,
    Konstantin Petkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Wit
    Wit avatar
    24 posts
    Member since:
    Jul 2010

    Posted 14 Sep 2010 Link to this post

    Cool!
    Just installed the 2010.2.914.0 build and sample test now fires autosuggest.

    Thank you for this fix. It's so good to see fixing going in so quickly :-)
Back to Top