Forum Discussion

izaboo's avatar
izaboo
New Contributor
15 years ago

How to find a silverlight elements (avoid usage of full paths to each element)

Greetings,



I’m trying to acquire basic knowledge of testcomplete testing of Silverlight  apps and faced with a problem.


While my testing of .net web application i used page objects and operate with them via NativeWebObject, ecpecially NativeWebObject.Find().


Whether same "find" approach is acceptable for Silverlight applications?


For example i tried example code (on silverlight.net)


Sub Main


  Dim p, page, app, menu, menu1, i


  ' Launch Internet Explorer and load Silverlight Toolkit Samples


  Call Win32API.WinExec(BuiltIn.GetCOMServerPath("InternetExplorer.Application"), SW_NORMAL)


  Set p = Sys.Process("IEXPLORE")


  Set page = p.Page("*").ToUrl("http://silverlight.net/samples/sl2/toolkitcontrolsamples/run/default.html")


  Set app = page.Panel("silverlightControlHost").Object(0)


  Set menu = app.UIAObject("SampleSelection")


  menu.UIAObject("TreeViewItem", 4).Click


 


  Set menu1 = app.UIAObject("SamplesTab")


menu1.UIAObject("TabItem").UIAObject("VactionTreeView").UIAObject("UniqueId118_").UIAObject("UniqueId186_").UIAObject("Italy").UIAObject("Italy").Click


End Sub


 


and was succeeded to click "Italy" only via its full path.


Could you point me, is there any simple way of exploring Silverlight elements except using their full paths. Possibly i'm demanding too much?

Thank in advance!

3 Replies

  • szein's avatar
    szein
    Occasional Contributor
    hello Ana,

    i am facing the same porblem, can you please show me how you solved it?



    thanx,

    Samer
  • Hi,



    Can you describe the actions you perform, the behavior you get and the behavior you expect to get in detail?