Silverlight Focussed Element and Selected Text

3 posts, 0 answers
  1. Luke Ryan
    Luke Ryan avatar
    6 posts
    Member since:
    Feb 2010

    Posted 20 Jun 2010 Link to this post

    We are using WebAii for Silverlight Automation testing
    In our XAML we have a button that when clicked creates a form with a text box (System.Windows.Controls.TextBox) that is given focus with a default value that is selected.

    Given we have found the element (Xaml.Get<ArtOfTest.WebAii.Silverlight.UI.TextBox>("Name=InputTextBox"); 
    Is there a way we can test to check that the element
    1) Has Focus
    2) Has text in it that is selected

  2. Missing user
    Missing user avatar

    Posted 23 Jun 2010 Link to this post

    Hi Luke,

    I apologize for the late reply. For WebUI Test Studio, you can use the Sentence Verification Builder on the TextBox with 'Property' -> 'SelectedText'. Please see the 'Creating Advanced Test Verifications' in the QA or Dev quick start guide.

    If your using the WebAii Framework, you can use:

    string s = (string)b.GetProperty(new ArtOfTest.WebAii.Silverlight.AutomationProperty("SelectedText", typeof(string)));

    For determining if a SL control has focus, there is functionality to determine this, but unfortunately it is not currently exposed. I'll log a feature request to have this made available.

    Nelson Sin
    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
  3. Luke
    Luke avatar
    1 posts
    Member since:
    Apr 2015

    Posted 12 May 2015 Link to this post


    I'm also attempting to detect whether or not a Silverlight element has focus. Has this feature ever been exposed in the Silverlight test framework?

    Many thanks,

Back to Top