ClassWpfWindow
Actions for automating WPF window.
Definition
Namespace:ArtOfTest.WebAii.Wpf
Assembly:ArtOfTest.WebAii.dll
Syntax:
public class WpfWindow : VisualTreeHost, IApplication, IAutomationHost, ISupportSearchHost, IAnnotationHost, IDisposable
Inheritance: objectVisualTreeHostWpfWindow
Implements:
Inherited Members
Constructors
WpfWindow(IntPtr)
Create new instance of WpfWindow class.
Properties
Annotator
Declaration
public override Annotator Annotator { get; }
Property Value
Overrides
Implements
Application
The WPF application that the current window is part of.
Declaration
public WpfApplication Application { get; }
Property Value
Bounds
Gets the rectangular bounds of this app.
ContentWindow
Declaration
public override Window ContentWindow { get; }
Property Value
Overrides
Implements
Desktop
Gets the Desktop object for this app.
EnableValidateMouseLocation
Enables mouse location validation.
Declaration
public bool EnableValidateMouseLocation { get; set; }
Property Value
Implements
Find
Actions for finding visual elements.
Declaration
public virtual VisualFind Find { get; }
Property Value
Implements
FriendlyName
Returns a friendly name for this host
Declaration
public override string FriendlyName { get; }
Property Value
Overrides
Implements
IsConnected
Indicates whether current object is connected to window under test.
Declaration
public virtual bool IsConnected { get; }
Property Value
Implements
IsRecordingHost
Indicates whether a recorder is attached.
Declaration
public virtual bool IsRecordingHost { get; }
Property Value
Implements
ManagedProxy
Gets the ManagedProxy for this app.
Declaration
public virtual ICommunicationProxy ManagedProxy { get; }
Property Value
Implements
Manager
Declaration
public override Manager Manager { get; }
Property Value
Overrides
Implements
TechnologyType
VisualTreeHosts are only used for Silverlight
Declaration
public override TechnologyType TechnologyType { get; }
Property Value
Overrides
Implements
UniqueId
A unique identifier that identifies this plugin instance. This id is updated only when the plug-in is reloaded on a postback or a browser refresh.
Declaration
public override string UniqueId { get; }
Property Value
Overrides
Implements
Methods
AddCustomAssembly(string, string)
Register assembly to be loaded in app under test. Actual loading happens when new window is created or when InitializeCustomWpfTypes() is called.
AddCustomAssemblyFolder(string)
Register folder containing asseblies to be loaded in app under test. Actual loading happens when new window is created or when InitializeCustomWpfTypes() is called. Note that .net core applications will load only assemblies from 'netcore' subfolder.
Declaration
public static void AddCustomAssemblyFolder(string assemblyFolder)
Parameters
assemblyFolder
Path of the folder.
Capture()
Return a bitmap of the host
Capture(FrameworkElement)
Capture the image of an element.
Declaration
public Bitmap Capture(FrameworkElement element)
Parameters
element
The element to interact with.
Returns
The element image/
Implements
ClearCustomAsseblies()
Clear all assemblies registered by ClearCustomAsseblies().
Declaration
public static void ClearCustomAsseblies()
ClearCustomAssemblyFolders()
Clear all assembly folders registered by AddCustomAssemblyFolder(string).
Declaration
public static void ClearCustomAssemblyFolders()
DetachFromWindowEvents()
Stop listening window events.
Declaration
protected void DetachFromWindowEvents()
ElementFromPoint(int, int)
Get the framework element that is located under specific point.
Declaration
public virtual FrameworkElement ElementFromPoint(int x, int y)
Parameters
x
The point X coordinate.
y
The point Y coordinate.
Returns
The framework element that is located under specific point.
Implements
EnsureElementClickable(FrameworkElement)
Ensure that an element is in the visible part of the window.
Declaration
public void EnsureElementClickable(FrameworkElement element)
Parameters
element
The element to interact with.
Implements
EnsureStateIsCurrent()
Will force the VisualTree to Refresh. Identical to VisualTree.Refresh().
Declaration
public override void EnsureStateIsCurrent()
Overrides
Implements
GetChildHosts()
Get all contained hosts.
Declaration
public override IAutomationHost[] GetChildHosts()
Returns
Contained Hosts
Overrides
Implements
GetScreenRectangle(FrameworkElement)
Get the bounding rectangle of an element in screen coordinates.
Declaration
public virtual Rectangle GetScreenRectangle(FrameworkElement element)
Parameters
element
The element to interact with.
Returns
The element bounding rectangle.
Implements
GetToolTipText(FrameworkElement)
Get the tooltip text of an element.
Declaration
public virtual string GetToolTipText(FrameworkElement element)
Parameters
element
The element to interact with.
Returns
The element tooltip text.
Implements
GetWindowRectangle()
Gets the rectangle of window containing this host
Declaration
public override Rectangle GetWindowRectangle()
Returns
Overrides
Implements
InitializeCustomWpfTypes()
Ask app under test to load assemblies with custom wpf types.
Declaration
public void InitializeCustomWpfTypes()
LocateInHost(string[])
Locate an element in this host or any of the children of this host using an expression.
Declaration
public override ITargetElement LocateInHost(string[] expression)
Parameters
expression
string[]
Returns
Overrides
Implements
OnRecordingWindowClosed()
Declaration
protected virtual void OnRecordingWindowClosed()
PopulateVisualTree()
Populate visual tree using the latest state from window under test.
Declaration
public virtual VisualTree PopulateVisualTree()
Returns
Newly generated visual tree.
Implements
RefreshVisualTrees()
Refreshes the main visual tree for the application as well as any open Popup visual trees.
Declaration
public void RefreshVisualTrees()
Implements
ResizeContainer(int, int, int, int)
Resize window under test.
SetWindowFocus()
Makes the window containing this host active
Declaration
public override bool SetWindowFocus()
Returns
Whether we successfully set the window to active
Overrides
Implements
ValidateMouseLocation(Point)
Validate the location of the mouse.
Declaration
public override void ValidateMouseLocation(Point point)
Parameters
point
Overrides
Implements
Events
WindowClosed
This event is triggered when the wrapped window closes