Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi,

I have a main window (WPF) and a frame in it. A page control is opened in the frame area.

Within the page control, I have TabList control. The Fist tab (tab1) has a WebBrowser Control which host some Html content.

While writing Coded UI Test, I'm able to locate (tab1) control but unable to get its children or the Webbrowser contriol.

I need to find the Webbrowser control or the HTML document it hosts, in order to find Image within the HTML doc.

Following is the XAML for Webbrowser:

XML
<WebBrowser Margin="10" Name="webDocument"  AutomationProperties.AutomationId="DOC_01" LoadCompleted="WebDocumentLoadCompleted" Visibility="{Binding Source={StaticResource viewModel},Path= IsWebDocumentVisible ,Converter={StaticResource boolToVis},ConverterParameter=True}" >
										<Interactivity:Interaction.Behaviors>
											<local:BubbleScrollWheelBehavior/>
										</Interactivity:Interaction.Behaviors>
</WebBrowser>

Following is the Coded Ui c# part:
WpfTabList tablist = new WpfTabList(TopParent.MainWindow);
            tablist.SearchProperties[WpfTabList.PropertyNames.ClassName] = "Uia.TabControl";
            tablist.SearchProperties[WpfTabList.PropertyNames.AutomationId] = "tabControlMain";

            WpfTabPage tabDoc = new WpfTabPage(tablist);
            tabDoc.SearchProperties[WpfTabPage.PropertyNames.ClassName] = "Uia.TabItem";
            tabDoc.SearchProperties[WpfTabPage.PropertyNames.AutomationId] = "tab1";

            WpfCustom custom = new WpfCustom(tabDoc);
            custom.SearchProperties[WpfCustom.PropertyNames.ClassName] = "HtmlBody";

            HtmlImage mUItoolImage = new HtmlImage(custom);
            mUItoolImage.SearchProperties[HtmlEdit.PropertyNames.Id] = "tool_MiningTool1";

It is failing and Html part is not being determined.

Your help is much appreciated.

Thanks,
Abhishek

What I have tried:

I've tried the above code. I've also used Inspect.exe to determine the parent child relationship, but still can't get the Webbrowser control anywhere.
Posted
Updated 9-Jan-17 18:02pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900