Ask a Question

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

Oferv
Super Contributor

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
6 REPLIES 6
Abramova
Staff

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

Hi,


To wait for WPF objects, you can use the special WaitWPFObject method. For example:




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


Also, I recommend that you read the Waiting for an Object, Process or Window Activation online article.

I’m not a member of the SmartBear Support Team, I’m just helping users in this community. Any views or opinions expressed do not necessarily represent those of SmartBear Software.
Oferv
Super Contributor

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

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
Abramova
Staff

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

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/.

I’m not a member of the SmartBear Support Team, I’m just helping users in this community. Any views or opinions expressed do not necessarily represent those of SmartBear Software.
Oferv
Super Contributor

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

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.
Abramova
Staff

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

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?

I’m not a member of the SmartBear Support Team, I’m just helping users in this community. Any views or opinions expressed do not necessarily represent those of SmartBear Software.
Oferv
Super Contributor

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

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
cancel
Showing results for 
Search instead for 
Did you mean: