ClassManager
This class manages the life spans and instances of all browser objects in the framework. It also manages the communication pipeline between the framework and all browsers.
Definition
Namespace:ArtOfTest.WebAii.Core
Assembly:ArtOfTest.WebAii.dll
Syntax:
public class Manager : IDisposable
Inheritance: objectManager
Implements:
Constructors
Manager(Settings)
Create a new Manager.
Declaration
public Manager(Settings settings)
Parameters
settings
The settings object that specifies the settings to initialize the framework with. These settings are propagated through out the framework objects.
Manager(bool)
Create a new Manager.
Declaration
public Manager(bool useConfig)
Parameters
useConfig
If set to true, the manager will load the setting from the config. Else will use the default settings.
Properties
ActiveApplication
Returns the active wpf application managed by the Manager.
Declaration
public WpfApplication ActiveApplication { get; }
Property Value
ActiveBrowser
Gets the ActiveBrowser which is the last browser launched by the current instance of the Manager.
ActiveDesktopApplication
Declaration
public DesktopApplication ActiveDesktopApplication { get; }
Property Value
Applications
Returns a read-only list of applications managed by the Manager
Declaration
public IList<WpfApplication> Applications { get; }
Property Value
Browsers
Gets the array of browser instances connected to this instance of the Manager. This should be considered a one-time snapshot and long-term object references to it should be avoided.
Declaration
public ReadOnlyCollection<Browser> Browsers { get; }
Property Value
Current
Gets the current active manager object.
Desktop
Gets the Desktop object that can be used to invoke desktop input devices like Mouse, Keyboard events. Desktop actions are only allowed if the active user session is in interactive mode. http://docs.telerik.com/teststudio/user-guide/knowledge-base/test-execution/no-tests-execute-on-locked-machine.aspx
DesktopApplications
Array of desktop applications managed by the Manager.
Declaration
public DesktopApplication[] DesktopApplications { get; }
Property Value
DialogMonitor
Gets the DialogMonitor object that handles the dialogs collection, dialog monitoring and automatic handle of unexpected dialogs.
Declaration
public DialogMonitor DialogMonitor { get; }
Property Value
Disposed
Track whether dispose has been called.
Elements
Returns the element finder object used for finding elements defined by their FindParam attributes. Used to set element finder settings like waitForElement timeout, element merge, etc...
ErrorStatus
Set or get the error status of the manager as string.
Http
Gets the HttpProxy instance if UseHttpProxy is set to true, else will return null.
Log
Gets the Log object.
PipeName
Get the provisioning pipe name.
Settings
Gets the settings object that this Manager instance was initialized with.
Methods
AddNewBrowser(Browser)
Add a new browser to the Manager.Browsers[] collection.
Declaration
public void AddNewBrowser(Browser browser)
Parameters
browser
browser object managed by the Manager
AddPdfPortToUrlIfNeeded(string)
Add to the provided URL the port of the Test Studio PDF viewer server if needed.
ClearMappingsOverride(Type)
Clear the global override mappings for the specified type.
Declaration
public static void ClearMappingsOverride(Type controlType)
Parameters
controlType
The type to clear the mappings for.
ConfigureBrowser(BrowserType, out string)
Aplly browser settings, required for automation to work correctly. In order to aplly the settings correctly all browser instances of the specified type must be closed.
Declaration
public bool ConfigureBrowser(BrowserType browser, out string error)
Parameters
browser
The type of browser to configure.
error
Contains an error message in case the browser was not successfully calibrated (applicable for Chrome).
Returns
Browser state after we attempt to callibrate it(applicable for Chrome).
ConnectToApplication(Process, string)
Connect to an active wpf application.
Declaration
public WpfApplication ConnectToApplication(Process proc, string pid = null)
Parameters
proc
Wpf process info
pid
Process id of the wpf app
Returns
The WPFApplication object when after successful connection
ConnectToApplication(Process, string, int)
Connect to an active wpf application.
Declaration
public WpfApplication ConnectToApplication(Process proc, string pid, int timeout = 5000)
Parameters
proc
pid
timeout
Returns
ConnectToApplication(string, int, int)
Connect to an active wpf application.
Declaration
public WpfApplication ConnectToApplication(string processName, int processIndex = 0, int timeout = 5000)
Parameters
processName
processIndex
timeout
Returns
Exceptions
ConnectToDesktopApplication(Process)
Connect to already running desktop application.
Declaration
public DesktopApplication ConnectToDesktopApplication(Process process)
Parameters
process
Returns
ConnectToDesktopApplication(Process, int)
Connect to already running desktop application.
Declaration
public DesktopApplication ConnectToDesktopApplication(Process process, int timeout = 5000)
Parameters
process
Application process.
timeout
Time in ms to wait for app application main window to occur.
Returns
Instance of DesktopApplication.
ConnectToDesktopApplication(string, int, int)
Connect to already running desktop application.
Declaration
public DesktopApplication ConnectToDesktopApplication(string processName, int processIndex = 0, int timeout = 5000)
Parameters
processName
Name of already running process.
processIndex
Index the process after name filtering is applied.
timeout
Time in ms to wait for app application main window to occur.
Returns
Instance of DesktopApplication.
Dispose()
Dispose of resources controlled by this object.
Declaration
public void Dispose()
Implements
GetBrowserConfigurationStatus(BrowserType)
Get browser configureation status.
Declaration
public BrowserConfigurationStatus GetBrowserConfigurationStatus(BrowserType browser)
Parameters
browser
Browser type.
Returns
Browser configuration status.
LaunchNewApplication(ProcessStartInfo)
Launch new wpf app using ProccessStartInfo
Declaration
public WpfApplication LaunchNewApplication(ProcessStartInfo pinfo)
Parameters
pinfo
ProccessStartInfo object for the wpf app
Returns
WPFApplication object to be used in the automation.
LaunchNewApplication(string, params string[])
Launch a new WPF Application for automation
Declaration
public WpfApplication LaunchNewApplication(string path, params string[] args)
Parameters
path
The fully qualified path to the WPF Application. This path can include environment varibales
args
string[]
Arguments to pass to the WPF Application
Returns
WpfApplication object that can be used in the automation
LaunchNewBrowser()
Launch a new browser using default settings. Waits for browser to connect.
Declaration
public void LaunchNewBrowser()
LaunchNewBrowser(BrowserType)
Launch a new browser of the selected type and wait for it to connect.
Declaration
public void LaunchNewBrowser(BrowserType browserToLaunch)
Parameters
browserToLaunch
The browser type to launch.
LaunchNewBrowser(BrowserType, bool)
Launch a new browser of the specified BrowserType.
Declaration
public void LaunchNewBrowser(BrowserType browserToLaunch, bool waitForBrowserToConnect)
Parameters
browserToLaunch
The browser type to launch.
waitForBrowserToConnect
True/False to wait for the browser to connect or not.
LaunchNewBrowser(BrowserType, bool, ProcessWindowStyle)
Launch a new browser of the specified BrowserType and set window style
Declaration
public void LaunchNewBrowser(BrowserType browserToLaunch, bool waitForBrowserToConnect, ProcessWindowStyle windowStyle)
Parameters
browserToLaunch
The browser to launch.
waitForBrowserToConnect
True/False to wait for the browser to connect or not.
windowStyle
The window style to launch the browser in.
LaunchNewBrowser(BrowserType, bool, ProcessWindowStyle, string)
Launch a new browser of the specified BrowserType and set window style. Pass arguments to the browser launch proccess. Applicable for internet explorer and silverlight out of browser.
Declaration
public void LaunchNewBrowser(BrowserType browserToLaunch, bool waitForBrowserToConnect, ProcessWindowStyle windowStyle, string arguments)
Parameters
browserToLaunch
The browser to launch.
waitForBrowserToConnect
True/False to wait for the browser to connect or not.
windowStyle
The window style to launch the browser in.
arguments
Arguments to pass to the browser launch proccess (for IE and sliverlight only). URL for IE and path to silverlight out of browser app.
LaunchNewBrowser(ProcessWindowStyle)
Launch a new browser using the default settings and sets the browser window style. Waits for browser to connect.
Declaration
public void LaunchNewBrowser(ProcessWindowStyle windowStyle)
Parameters
windowStyle
The window style to launch the browser in.
LaunchNewBrowser(ProcessWindowStyle, string)
Launch a new browser using the default settings, sets the browser window style and passes arguments to the browser. Applicable for internet explorer and silverlight out of browser. Waits for browser to connect.
Declaration
public void LaunchNewBrowser(ProcessWindowStyle windowStyle, string arguments)
Parameters
windowStyle
The window style to launch the browser in.
arguments
Arguments to pass to the browser launch proccess (for IE and sliverlight only). URL for IE and path to silverlight out of browser app.
LaunchNewDesktopApplication(string, string, string, int)
Launch new desktop application.
Declaration
public DesktopApplication LaunchNewDesktopApplication(string path, string arguments = null, string workingDirectory = null, int timeout = 5000)
Parameters
path
Path to application executable.
arguments
Startup arguments.
workingDirectory
Application working directory.
timeout
Timeout in ms to wait for application main window to occur.
Returns
Instance of DesktopApplication.
LaunchNewDesktopApplicationFromStore(string, string, int, int)
Launch new store desktop application.
Declaration
public DesktopApplication LaunchNewDesktopApplicationFromStore(string appUserModelId, string arguments = null, int timeout = 20000, int initDelay = 1000)
Parameters
appUserModelId
App store id.
arguments
Start up arguments.
timeout
Time in ms to wait for app application main window to occur.
initDelay
Time in ms to wait after application main window occurs.
Returns
Instance of DesktopApplication.
RegisterMappingsOverride(MappingsCollection, Type)
Overrides the set of mappings for a spcified control type.
Declaration
public static void RegisterMappingsOverride(MappingsCollection mappingsToOverride, Type controlType)
Parameters
mappingsToOverride
The list of mappings to override for the control type
controlType
The type to override the mappings for.
RemoveBrowser(string)
Remove a browser from the Manager.Browsers[] collection.
Declaration
public void RemoveBrowser(string clientId)
Parameters
clientId
client ID of the browser object
Remarks
Calling Browser.Close eventually calls back into the manager and into this function (be extra careful about deadlocks).
SetNewBrowserTracking(bool)
Enable or disable new browser tracking. Use to track pop-up browser windows. When enabled, new pop-up browser windows will be added to the Manager.Browsers[] collection.
Declaration
public void SetNewBrowserTracking(bool enable)
Parameters
enable
True/false whether to enable/disable new browser tracking.
Start()
Initialize the communication pipelines and the Test Manager.
Declaration
public void Start()
UndoBrowserConfiguration(BrowserType, out string)
Restore browser to previous configuration before the calibration.
Declaration
public bool UndoBrowserConfiguration(BrowserType browser, out string error)
Parameters
browser
Set the browser type for which to restore the previous configuration
error
Contains an error message in case the browser was not successfully calibrated(applicable for Chrome).
Returns
Browser state after we attempt to callibrate it(applicable for Chrome).
WaitForNewBrowserConnect(string, bool, int)
Wait for a specific browser instance to connect using a timeout.
WaitForNewBrowserConnect(string, bool, string, int)
Wait for a specific browser instance to connect using a timeout.
Declaration
public void WaitForNewBrowserConnect(string url, bool isPartial, string partialCaption, int timeout)
Parameters
url
The url by which to identify new browser instances.
isPartial
Whether to check the url using partial compares.
partialCaption
Partial caption of the loaded url.
timeout
Wait for browser to connect timeout in ms
Events
ActiveBrowserChanged
Occurs when active browser is changed. This event will fire after attachment to the new browser instance.
Declaration
public event Manager.ActiveBrowserChangedHandler ActiveBrowserChanged
Event Value