Find Object Properties

10 posts, 0 answers
  1. Hardeep
    Hardeep avatar
    3 posts
    Member since:
    Mar 2011

    Posted 23 Mar 2011 Link to this post

    What are the steps we can follow to find the object properties in the Silverlight web application in IE browser.

    I am using free Webaii framework in Visual Studio 2010.

    Does Webaii framework provides any tool for that or we need to use Spy ++ . If we have to use Spy ++ then - please explain the steps to find any object property in the Silverlight web application in IE browser.
  2. Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 25 Mar 2011 Link to this post

    Hello Hardeep,
        the WebAii Framework per se is just an API for UI testing.
    It sounds like you need the to use Test Studio. Test Studio offers many enhanced capabilities related  to test automation. One of these is the DOM Explorer which will let you explore a Silverlight application very extensively.
    You can download a Test Studio Trail from your account.

    I believe Spy++ only works on certain desktop applications and can't be used for Silverlight. I have very little experience with it so I'm not sure. I'm sure you can find plenty if info on the Internet.

    Hope to hear from you soon!

    Best wishes,
    Stoich
    the Telerik team
  3. Hardeep
    Hardeep avatar
    3 posts
    Member since:
    Mar 2011

    Posted 25 Mar 2011 Link to this post

    Hi Stoich,

    Thanks for your suggestion. Right now we are just looking on evaluting WebAii free framework and automate some of the scenarios.
    I have surfed on internet there are some tools avaliable to Spy Silverlight application.
    Please let me now if there is any best free tool around that we can use for getting silverlight application object properties.

    Thanks,
    Hardeep
  4. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 27 Mar 2011 Link to this post

    Hello Hardeep,

    We are not aware of any really good and free tool for fetching the properties of Silverlight elements, although we haven't done an extensive search for such a tool either. Our free framework can read most properties attached to Silverlight elements, but you have to know what property you are looking for ahead of time. Here's a code example:

    Brush textblockBrush = (Brush)Pages.TelerikTreeViewFor.SilverlightApp.InstallerTextblock.GetProperty(new AutomationProperty("Foreground", typeof(Brush)));

    Best wishes,
    Cody
    the Telerik team
  5. Hardeep
    Hardeep avatar
    3 posts
    Member since:
    Mar 2011

    Posted 28 Mar 2011 Link to this post

    Thanks Cody,

    Can you please help me out with use of this code. Like what are libraries that needs to be added and basically what are should be declare in "Using". I tried using

    using Brush=ArtOfTest.WebAii.Silverlight.UI.Brush;

    Brush textblockBrush = (Brush)Pages.TelerikTreeViewFor.SilverlightApp.InstallerTextblock.GetProperty(newAutomationProperty("Foreground", typeof(Brush)));

    But it throws error for Pages

    Can you provide me the complete code how I can print the Object properties in the silverlight application on console.

    Thanks,
    Hardeep
  6. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 29 Mar 2011 Link to this post

    Hello Hardeep,

    To make it easy for you I've attached a complete sample VS 2010 project.

    Kind regards,
    Cody
    the Telerik team
  7. emma
    emma avatar
    4 posts
    Member since:
    May 2011

    Posted 04 Oct 2012 Link to this post

    Hi, we are trying to fetch int[] property of our silverlight element using the following code:
    var SelectedIndexes = grid.GetProperty(new AutomationProperty("SelectedIndexes", typeof(int[])));

    The following exception occurs running the test:
    Invalid cast from 'System.String' to 'System.Int32[]'.

    Is int[] type supported?

    Thanks very much.
  8. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 04 Oct 2012 Link to this post

    Hello Emma,

    No I am sorry. We cannot handle arrays of any kind with the GetProperty function.

    All the best,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  9. Tomasz
    Tomasz avatar
    9 posts
    Member since:
    Mar 2016

    Posted 26 Sep Link to this post

    Hello,

    is there a way to read property of WPF application element during the test? I mean (for example) that Test Studio located (during the test) an element which have text content "some text" and I need to read/check (during the test) what is the TagIndex value of that element. Maybe it is possible in the coded step? Could You tell mi some advice?
  10. Elena Tsvetkova
    Admin
    Elena Tsvetkova avatar
    254 posts

    Posted 29 Sep Link to this post

    Hello Tomasz,

    This could be accomplished in a coded step. The example below is for html element but it should be applicable for a wpf element as well. Please give it a try and get back to us in case you need further assistance. 

    HtmlDiv div = ActiveBrowser.Find.ById<HtmlDiv>("test");
    Log.WriteLine(div.BaseElement.TagNameIndex.ToString());


    Regards,
    Elena Tsvetkova
    Telerik by Progress
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!