Class
BaseDialog

A base implementation for a dialog.

Definition

Constructors

BaseDialog(Browser, DialogButton)

Create a new dialog.

Declaration

cs-api-definition
public BaseDialog(Browser parentBrowser, DialogButton dismissButton)

Parameters

parentBrowser

Browser

The parent browser. Expect null for non-web dialogs.

dismissButton

DialogButton

The button to use to dismiss the dialog.

BaseDialog(WpfApplication, DialogButton)

Create a new instance of BaseDialog class.

Declaration

cs-api-definition
public BaseDialog(WpfApplication application, DialogButton dismissButton)

Parameters

application

WpfApplication

The WPF application.

dismissButton

DialogButton

The dismiss button.

Fields

m_browserVersionMajor

The major version of the browser

Declaration

cs-api-definition
protected readonly int m_browserVersionMajor

Field Value

int

Properties

CurrentState

Gets/Sets the dialog current state. State is handled my DialogMonitor.

Declaration

cs-api-definition
public DialogCurrentState CurrentState { get; set; }

Property Value

DialogCurrentState

Implements IDialog.CurrentState

DismissButton

Gets/Sets the dismiss button to use to knock down this dialog.

Declaration

cs-api-definition
public DialogButton DismissButton { get; set; }

Property Value

DialogButton

ErrorText

Get or set error text.

Declaration

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

Property Value

string

Implements IDialog.ErrorText

HandleCount

Gets/Sets the number of times this dialog has been handled.

Declaration

cs-api-definition
public int HandleCount { get; set; }

Property Value

int

Implements IDialog.HandleCount

HandlerDelegate

Gets/Sets the dialog custom handler

Declaration

cs-api-definition
public DialogHandlerDelegate HandlerDelegate { get; set; }

Property Value

DialogHandlerDelegate

Implements IDialog.HandlerDelegate

InitializationTime

Gets/Sets the time to before handling of the dialog starts.

Declaration

cs-api-definition
public int InitializationTime { get; set; }

Property Value

int

Implements IDialog.InitializationTime

ParentBrowser

The parent browser object of this dialog

Declaration

cs-api-definition
protected Browser ParentBrowser { get; }

Property Value

Browser

SkipHandling

Get or set skip handling func.

Declaration

cs-api-definition
public Func<bool> SkipHandling { get; set; }

Property Value

Func<bool>

Implements IDialog.SkipHandling

Tags

Custom tags for miscellaneous use.

Declaration

cs-api-definition
public object[] Tags { get; set; }

Property Value

object[]

Window

The dialog Window object.

Declaration

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

Property Value

Window

Implements IDialog.Window

Methods

GetFilePaths(string)

In case of multiple file paths strips the delimiter double quotes and space and returns the paths.

Declaration

cs-api-definition
protected string[] GetFilePaths(string filePaths)

Parameters

filePaths

string

File paths separated with space and wrapped in double quotes.

Returns

string[]

String array withe all available paths.

Handle()

Handle the dialog. If HandlerDelegate is set, use the delegate

Declaration

cs-api-definition
public abstract void Handle()

Implements IDialog.Handle()

IsDialogActive(WindowCollection)

Detect whether this dialog is active or not. Mostly used for HWND-based controls, such as top-level windows.

Declaration

cs-api-definition
public abstract bool IsDialogActive(WindowCollection dialogs)

Parameters

dialogs

WindowCollection

The list of all dialogs.

Returns

bool

True/False whether this dialog is active or not.

Implements IDialog.IsDialogActive(WindowCollection)

IsDialogActiveByTitle(WindowCollection, string)

Get whether the dialog is active based on its title.

Declaration

cs-api-definition
protected bool IsDialogActiveByTitle(WindowCollection dialogs, string title)

Parameters

dialogs

WindowCollection

The list of dialogs to check.

title

string

The title to check for.

Returns

bool

True/False whether the dialog is active or not.

IsDialogActiveByTitle(WindowCollection, string, bool)

Get whether the dialog is active base on its title.

Declaration

cs-api-definition
protected bool IsDialogActiveByTitle(WindowCollection dialogs, string title, bool partialTitle)

Parameters

dialogs

WindowCollection

The list of dialogs to check.

title

string

The title to check for.

partialTitle

bool

True/False whether to do partial match or not.

Returns

bool

True/False whether the dialog is active or not.

IsDialogActiveByTitleAndTextContent(WindowCollection, string, bool, string)

Gets whether a dialog is active or not using the title and caption of an inner window contained in the dialog

Declaration

cs-api-definition
protected bool IsDialogActiveByTitleAndTextContent(WindowCollection dialogs, string title, bool partialTitle, string childWindowTextContent)

Parameters

dialogs

WindowCollection

The list of dialogs to check.

title

string

The title to check for.

partialTitle

bool

True/False whether to do partial match or not.

childWindowTextContent

string

The partial content of a child window

Returns

bool

True/False whether the dialog is active or not.

IsRejectedViaRegexOrExactMatch(string, object)

Check if rejected via regex or exact match.

Declaration

cs-api-definition
public static bool IsRejectedViaRegexOrExactMatch(string strActualValue, object regexOrString)

Parameters

strActualValue

string

Actual value.

regexOrString

object

Regex or string value.

Returns

bool

MatchesUIAutomationElement(AutomationElement)

Matches UI automation element.

Declaration

cs-api-definition
public virtual bool MatchesUIAutomationElement(AutomationElement element)

Parameters

element

AutomationElement

The element to check against.

Returns

bool

Implements IDialog.MatchesUIAutomationElement(AutomationElement)

OnBeforeHandle(EventArgs)

Invoked before dialog is handled.

Declaration

cs-api-definition
protected virtual void OnBeforeHandle(EventArgs args)

Parameters

args

EventArgs

Event arguments.

ResetHandleCount()

Resets the handle count back to zero.

Declaration

cs-api-definition
public void ResetHandleCount()

SetDialogWindow(Window)

Set the dialog window.

Declaration

cs-api-definition
protected void SetDialogWindow(Window dialogWindow)

Parameters

dialogWindow

Window

The dialog window object.

ToString()

Returns a string that represents the current object.

Declaration

cs-api-definition
public override string ToString()

Returns

string

Overrides object.ToString()

ValidatePaths(string, out string)

Validates paths for read permissions. In case of error returns false and sets an error message.

Declaration

cs-api-definition
protected bool ValidatePaths(string filePathsToSet, out string error)

Parameters

filePathsToSet

string

File paths separated with space and wrapped in double quotes.

error

string

An error message. In case of success it will be set to empty string.

Returns

bool

True if read access is available for all paths.

ValidatePid(int)

Make sure specified pid belongs to either active application or active browser;

Declaration

cs-api-definition
protected bool ValidatePid(int pid)

Parameters

pid

int

Pid to check.

Returns

bool

ValidateReadFileAccess(string, string, out string)

Checks for read access to the specified file path. In case of error returns false and sets an error message.

Declaration

cs-api-definition
protected bool ValidateReadFileAccess(string filePath, string dialogName, out string error)

Parameters

filePath

string

The path to file to check.

dialogName

string

The name of the dialog which requires the read access.

error

string

An error message. In case of success it will be set to empty string.

Returns

bool

True if read access is available

WaitUntilAnyHandled(IEnumerable<BaseDialog>, int, long, bool)

Wait untill any dialog is handles.

Declaration

cs-api-definition
public static void WaitUntilAnyHandled(IEnumerable<BaseDialog> dialogs, int handleCount, long timeoutMilliseconds, bool resetHandleCount = false)

Parameters

dialogs

IEnumerable<BaseDialog>

The dialogs to handle.

handleCount

int

Handle count.

timeoutMilliseconds

long

Timeout in milliseconds.

resetHandleCount

bool

Reset handle count.

Exceptions

TimeoutException

Thrown when operation times out.

Exception

Thrown when ErrorText is not empty and handle count is not reached.

WaitUntilHandled()

Waits for the dialog to be handled atleast once. Always performs a reset at the beginning of the wait. Will use the Settings.ClientReadyTimeout.

Declaration

cs-api-definition
public void WaitUntilHandled()

WaitUntilHandled(int)

Waits for the dialog to be handled atleast once. Always performs a reset at the being of the wait.

Declaration

cs-api-definition
public void WaitUntilHandled(int timeout)

Parameters

timeout

int

The timeout to use. (msec.)

WaitUntilHandled(int, int, bool)

Waits for the dialog to be handled handleCount. You can optionally reset the handle count before waiting.

Declaration

cs-api-definition
public void WaitUntilHandled(int handleCount, int timeout, bool resetHandleCount)

Parameters

handleCount

int

The handle count to wait for.

timeout

int

The time out in milli-seconds to wait for count.

resetHandleCount

bool

True/False whether to reset the handle count before starting.

Events

BeforeHandle

Fired before handling the dialog.

Declaration

cs-api-definition
public event EventHandler BeforeHandle

Event Value

EventHandler