Forum Discussion

Oferv's avatar
Oferv
Super Contributor
13 years ago

How can i use "WaitAliasesChild" method on WPF object?

Hi,



I'm have a lot of use with "WaitAliasesChild" but, now I need to wait for a child object that is a WPF 's object.

Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["WPFObject"]("BusyMessageControl")["WPFObject"]("LayoutRoot")



for example,how can i make sure "BusyMessageControl" display on the screen? in regular case i would use:

Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["WaitAliasChild"]("BusyMessageControl",1000)

but,in this cases where i have the ["WPFObject"] addition before the object name what's the way of making sure the object display before moving on?



I'm stuck :(



Thanks
  • Oferv's avatar
    Oferv
    Super Contributor
    Ok, and what if my WPFObject looks like this



    if(Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["WPFObject"]("ContentPanel")["WPFObject"]("PART_SelectedContentHost")["WPFObject"]("AssemblyViewTabControl")["WPFObject"]("Grid", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("UserControl")["WPFObject"]("UserControl")["WPFObject"]("TabItem", "", NumberOfTabs)["WPFObject"]("UserControl")["WPFObject"]("StackPanel", "", 1)["WPFObject"]("TextBlock", FileWithoutExt, 1)["Exists"])



    the Bold part is actually the part i need to wait for untill keep on running now, the FileWithoutExt  is a tab added to the application has its unique name.i tried to wait for WaitWPFObject("TextBlock",10000)  but it didn't work.

    what's the syntax for waiting this kind of object?



    Thanks
  • Hi Ofer,


    If the tab caption changes from one application run to another, you can use the asterisk (*) wildcard in place of the caption. For example:


    if(Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["WPFObject"]("ContentPanel")["WPFObject"]("PART_SelectedContentHost")["WPFObject"]("AssemblyViewTabControl")["WPFObject"]("Grid", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("UserControl")["WPFObject"]("UserControl")["WPFObject"]("TabItem", "", NumberOfTabs)["WPFObject"]("UserControl")["WPFObject"]("StackPanel", "", 1)["WaitWPFObject"]("TextBlock", "*", 10000)["Exists"])


    For more information on using wildcards, please refer to http://smartbear.com/support/viewarticle/18943/.

  • Oferv's avatar
    Oferv
    Super Contributor
    mnnnnnn yes i know that but the problem in my script is that the new added tab is getting unique name which is the file name itself and the wild card is not relevant becaue there can be other tabs created already.TC if will get wild card won't know what tab i'm referring to so the tab name is essential here.
  • Hi,


    You can use the statement you mentioned in your previous post:


    if(Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["WPFObject"]("ContentPanel")["WPFObject"]("PART_SelectedContentHost")["WPFObject"]("AssemblyViewTabControl")["WPFObject"]("Grid", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("UserControl")["WPFObject"]("UserControl")["WPFObject"]("TabItem", "", NumberOfTabs)["WPFObject"]("UserControl")["WPFObject"]("StackPanel", "", 1)["WPFObject"]("TextBlock", FileWithoutExt, 1)["Exists"])


    Did you try to use this statement? Do any errors occur?

  • Oferv's avatar
    Oferv
    Super Contributor
    Hi Margaret,



    i have used 

    if(Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["WPFObject"]("ContentPanel")["WPFObject"]("PART_SelectedContentHost")["WPFObject"]("AssemblyViewTabControl")["WPFObject"]("Grid", "", 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("UserControl")["WPFObject"]("UserControl")["WPFObject"]("TabItem", "", NumberOfTabs)["WPFObject"]("UserControl")["WPFObject"]("StackPanel", "", 1)["WaitWPFObject"]("TextBlock", FileWithoutExt, 1)["Exists"])


    and i think it works fine.



    Thanks for the help