Class
Manager

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:

cs-api-definition
public class Manager : IDisposable

Inheritance: objectManager

Implements: IDisposable

Constructors

Manager(Settings)

Create a new Manager.

Declaration

cs-api-definition
public Manager(Settings settings)

Parameters

settings

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

cs-api-definition
public Manager(bool useConfig)

Parameters

useConfig

bool

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

cs-api-definition
public WpfApplication ActiveApplication { get; }

Property Value

WpfApplication

ActiveBrowser

Gets the ActiveBrowser which is the last browser launched by the current instance of the Manager.

Declaration

cs-api-definition
public Browser ActiveBrowser { get; }

Property Value

Browser

ActiveDesktopApplication

Declaration

cs-api-definition
public DesktopApplication ActiveDesktopApplication { get; }

Property Value

DesktopApplication

Applications

Returns a read-only list of applications managed by the Manager

Declaration

cs-api-definition
public IList<WpfApplication> Applications { get; }

Property Value

IList<WpfApplication>

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

cs-api-definition
public ReadOnlyCollection<Browser> Browsers { get; }

Property Value

ReadOnlyCollection<Browser>

Current

Gets the current active manager object.

Declaration

cs-api-definition
public static Manager Current { get; }

Property Value

Manager

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

Declaration

cs-api-definition
public Desktop Desktop { get; }

Property Value

Desktop

DesktopApplications

Array of desktop applications managed by the Manager.

Declaration

cs-api-definition
public DesktopApplication[] DesktopApplications { get; }

Property Value

DesktopApplication[]

DialogMonitor

Gets the DialogMonitor object that handles the dialogs collection, dialog monitoring and automatic handle of unexpected dialogs.

Declaration

cs-api-definition
public DialogMonitor DialogMonitor { get; }

Property Value

DialogMonitor

Disposed

Track whether dispose has been called.

Declaration

cs-api-definition
public bool Disposed { get; }

Property Value

bool

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

Declaration

cs-api-definition
public ElementFinder Elements { get; }

Property Value

ElementFinder

ErrorStatus

Set or get the error status of the manager as string.

Declaration

cs-api-definition
public string ErrorStatus { get; set; }

Property Value

string

Http

Gets the HttpProxy instance if UseHttpProxy is set to true, else will return null.

Declaration

cs-api-definition
public HttpProxyManager Http { get; }

Property Value

HttpProxyManager

Log

Gets the Log object.

Declaration

cs-api-definition
public Log Log { get; set; }

Property Value

Log

PipeName

Get the provisioning pipe name.

Declaration

cs-api-definition
public string PipeName { get; }

Property Value

string

Settings

Gets the settings object that this Manager instance was initialized with.

Declaration

cs-api-definition
public Settings Settings { get; }

Property Value

Settings

Wait

Returns a synchronous wait object that can be used to wait for specific actions on elements/controls or custom predicate actions.

Declaration

cs-api-definition
public WaitSync Wait { get; }

Property Value

WaitSync

Methods

AddNewBrowser(Browser)

Add a new browser to the Manager.Browsers[] collection.

Declaration

cs-api-definition
public void AddNewBrowser(Browser browser)

Parameters

browser

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.

Declaration

cs-api-definition
public string AddPdfPortToUrlIfNeeded(string baseUrl)

Parameters

baseUrl

string

URL to update.

Returns

string

Same URL or URL with correct PDF server port for URLs pointing towards Test Studio PDF viewer server.

ClearMappingsOverride(Type)

Clear the global override mappings for the specified type.

Declaration

cs-api-definition
public static void ClearMappingsOverride(Type controlType)

Parameters

controlType

Type

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

cs-api-definition
public bool ConfigureBrowser(BrowserType browser, out string error)

Parameters

browser

BrowserType

The type of browser to configure.

error

string

Contains an error message in case the browser was not successfully calibrated (applicable for Chrome).

Returns

bool

Browser state after we attempt to callibrate it(applicable for Chrome).

ConnectToApplication(Process, string)

Connect to an active wpf application.

Declaration

cs-api-definition
public WpfApplication ConnectToApplication(Process proc, string pid = null)

Parameters

proc

Process

Wpf process info

pid

string

Process id of the wpf app

Returns

WpfApplication

The WPFApplication object when after successful connection

ConnectToApplication(Process, string, int)

Connect to an active wpf application.

Declaration

cs-api-definition
public WpfApplication ConnectToApplication(Process proc, string pid, int timeout = 5000)

Parameters

proc

Process

pid

string

timeout

int

Returns

WpfApplication

ConnectToApplication(string, int, int)

Connect to an active wpf application.

Declaration

cs-api-definition
public WpfApplication ConnectToApplication(string processName, int processIndex = 0, int timeout = 5000)

Parameters

processName

string

processIndex

int

timeout

int

Returns

WpfApplication

Exceptions

InvalidOperationException

ConnectToDesktopApplication(Process)

Connect to already running desktop application.

Declaration

cs-api-definition
public DesktopApplication ConnectToDesktopApplication(Process process)

Parameters

process

Process

Returns

DesktopApplication

ConnectToDesktopApplication(Process, int)

Connect to already running desktop application.

Declaration

cs-api-definition
public DesktopApplication ConnectToDesktopApplication(Process process, int timeout = 5000)

Parameters

process

Process

Application process.

timeout

int

Time in ms to wait for app application main window to occur.

Returns

DesktopApplication

Instance of DesktopApplication.

ConnectToDesktopApplication(string, int, int)

Connect to already running desktop application.

Declaration

cs-api-definition
public DesktopApplication ConnectToDesktopApplication(string processName, int processIndex = 0, int timeout = 5000)

Parameters

processName

string

Name of already running process.

processIndex

int

Index the process after name filtering is applied.

timeout

int

Time in ms to wait for app application main window to occur.

Returns

DesktopApplication

Instance of DesktopApplication.

Dispose()

Dispose of resources controlled by this object.

Declaration

cs-api-definition
public void Dispose()

Implements IDisposable.Dispose()

GetBrowserConfigurationStatus(BrowserType)

Get browser configureation status.

Declaration

cs-api-definition
public BrowserConfigurationStatus GetBrowserConfigurationStatus(BrowserType browser)

Parameters

browser

BrowserType

Browser type.

Returns

BrowserConfigurationStatus

Browser configuration status.

LaunchNewApplication(ProcessStartInfo)

Launch new wpf app using ProccessStartInfo

Declaration

cs-api-definition
public WpfApplication LaunchNewApplication(ProcessStartInfo pinfo)

Parameters

pinfo

ProcessStartInfo

ProccessStartInfo object for the wpf app

Returns

WpfApplication

WPFApplication object to be used in the automation.

LaunchNewApplication(string, params string[])

Launch a new WPF Application for automation

Declaration

cs-api-definition
public WpfApplication LaunchNewApplication(string path, params string[] args)

Parameters

path

string

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

WpfApplication object that can be used in the automation

LaunchNewBrowser()

Launch a new browser using default settings. Waits for browser to connect.

Declaration

cs-api-definition
public void LaunchNewBrowser()

LaunchNewBrowser(BrowserType)

Launch a new browser of the selected type and wait for it to connect.

Declaration

cs-api-definition
public void LaunchNewBrowser(BrowserType browserToLaunch)

Parameters

browserToLaunch

BrowserType

The browser type to launch.

LaunchNewBrowser(BrowserType, bool)

Launch a new browser of the specified BrowserType.

Declaration

cs-api-definition
public void LaunchNewBrowser(BrowserType browserToLaunch, bool waitForBrowserToConnect)

Parameters

browserToLaunch

BrowserType

The browser type to launch.

waitForBrowserToConnect

bool

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

cs-api-definition
public void LaunchNewBrowser(BrowserType browserToLaunch, bool waitForBrowserToConnect, ProcessWindowStyle windowStyle)

Parameters

browserToLaunch

BrowserType

The browser to launch.

waitForBrowserToConnect

bool

True/False to wait for the browser to connect or not.

windowStyle

ProcessWindowStyle

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

cs-api-definition
public void LaunchNewBrowser(BrowserType browserToLaunch, bool waitForBrowserToConnect, ProcessWindowStyle windowStyle, string arguments)

Parameters

browserToLaunch

BrowserType

The browser to launch.

waitForBrowserToConnect

bool

True/False to wait for the browser to connect or not.

windowStyle

ProcessWindowStyle

The window style to launch the browser in.

arguments

string

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

cs-api-definition
public void LaunchNewBrowser(ProcessWindowStyle windowStyle)

Parameters

windowStyle

ProcessWindowStyle

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

cs-api-definition
public void LaunchNewBrowser(ProcessWindowStyle windowStyle, string arguments)

Parameters

windowStyle

ProcessWindowStyle

The window style to launch the browser in.

arguments

string

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

cs-api-definition
public DesktopApplication LaunchNewDesktopApplication(string path, string arguments = null, string workingDirectory = null, int timeout = 5000)

Parameters

path

string

Path to application executable.

arguments

string

Startup arguments.

workingDirectory

string

Application working directory.

timeout

int

Timeout in ms to wait for application main window to occur.

Returns

DesktopApplication

Instance of DesktopApplication.

LaunchNewDesktopApplicationFromStore(string, string, int, int)

Launch new store desktop application.

Declaration

cs-api-definition
public DesktopApplication LaunchNewDesktopApplicationFromStore(string appUserModelId, string arguments = null, int timeout = 20000, int initDelay = 1000)

Parameters

appUserModelId

string

App store id.

arguments

string

Start up arguments.

timeout

int

Time in ms to wait for app application main window to occur.

initDelay

int

Time in ms to wait after application main window occurs.

Returns

DesktopApplication

Instance of DesktopApplication.

RegisterMappingsOverride(MappingsCollection, Type)

Overrides the set of mappings for a spcified control type.

Declaration

cs-api-definition
public static void RegisterMappingsOverride(MappingsCollection mappingsToOverride, Type controlType)

Parameters

mappingsToOverride

MappingsCollection

The list of mappings to override for the control type

controlType

Type

The type to override the mappings for.

RemoveBrowser(string)

Remove a browser from the Manager.Browsers[] collection.

Declaration

cs-api-definition
public void RemoveBrowser(string clientId)

Parameters

clientId

string

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

cs-api-definition
public void SetNewBrowserTracking(bool enable)

Parameters

enable

bool

True/false whether to enable/disable new browser tracking.

Start()

Initialize the communication pipelines and the Test Manager.

Declaration

cs-api-definition
public void Start()

UndoBrowserConfiguration(BrowserType, out string)

Restore browser to previous configuration before the calibration.

Declaration

cs-api-definition
public bool UndoBrowserConfiguration(BrowserType browser, out string error)

Parameters

browser

BrowserType

Set the browser type for which to restore the previous configuration

error

string

Contains an error message in case the browser was not successfully calibrated(applicable for Chrome).

Returns

bool

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.

Declaration

cs-api-definition
public void WaitForNewBrowserConnect(string url, bool isPartial, int timeout)

Parameters

url

string

The url by which to identify new browser instances.

isPartial

bool

Whether to check the url using partial compare.

timeout

int

Wait for browser to connect timeout in ms

WaitForNewBrowserConnect(string, bool, string, int)

Wait for a specific browser instance to connect using a timeout.

Declaration

cs-api-definition
public void WaitForNewBrowserConnect(string url, bool isPartial, string partialCaption, int timeout)

Parameters

url

string

The url by which to identify new browser instances.

isPartial

bool

Whether to check the url using partial compares.

partialCaption

string

Partial caption of the loaded url.

timeout

int

Wait for browser to connect timeout in ms

~Manager()

Destructor

Declaration

cs-api-definition
protected ~Manager()

Events

ActiveBrowserChanged

Occurs when active browser is changed. This event will fire after attachment to the new browser instance.

Declaration

cs-api-definition
public event Manager.ActiveBrowserChangedHandler ActiveBrowserChanged

Event Value

Manager.ActiveBrowserChangedHandler