ClassBaseDialog
A base implementation for a dialog.
Definition
Namespace:ArtOfTest.WebAii.Win32.Dialogs
Assembly:ArtOfTest.WebAii.dll
Syntax:
public abstract class BaseDialog : IDialog
Inheritance: objectBaseDialog
Derived Classes:
Implements:
Constructors
BaseDialog(Browser, DialogButton)
Create a new dialog.
Declaration
public BaseDialog(Browser parentBrowser, DialogButton dismissButton)
Parameters
parentBrowser
The parent browser. Expect null for non-web dialogs.
dismissButton
The button to use to dismiss the dialog.
BaseDialog(WpfApplication, DialogButton)
Create a new instance of BaseDialog class.
Declaration
public BaseDialog(WpfApplication application, DialogButton dismissButton)
Parameters
application
The WPF application.
dismissButton
The dismiss button.
Fields
m_browserVersionMajor
The major version of the browser
Properties
CurrentState
Gets/Sets the dialog current state. State is handled my DialogMonitor.
Declaration
public DialogCurrentState CurrentState { get; set; }
Property Value
Implements
DismissButton
Gets/Sets the dismiss button to use to knock down this dialog.
Declaration
public DialogButton DismissButton { get; set; }
Property Value
ErrorText
Get or set error text.
Declaration
public string ErrorText { get; set; }
Property Value
Implements
HandleCount
Gets/Sets the number of times this dialog has been handled.
HandlerDelegate
Gets/Sets the dialog custom handler
Declaration
public DialogHandlerDelegate HandlerDelegate { get; set; }
Property Value
Implements
InitializationTime
Gets/Sets the time to before handling of the dialog starts.
Declaration
public int InitializationTime { get; set; }
Property Value
Implements
ParentBrowser
The parent browser object of this dialog
SkipHandling
Get or set skip handling func.
Tags
Custom tags for miscellaneous use.
Methods
GetFilePaths(string)
In case of multiple file paths strips the delimiter double quotes and space and returns the paths.
Handle()
Handle the dialog. If HandlerDelegate is set, use the delegate
Declaration
public abstract void Handle()
Implements
IsDialogActive(WindowCollection)
Detect whether this dialog is active or not. Mostly used for HWND-based controls, such as top-level windows.
Declaration
public abstract bool IsDialogActive(WindowCollection dialogs)
Parameters
dialogs
The list of all dialogs.
Returns
True/False whether this dialog is active or not.
Implements
IsDialogActiveByTitle(WindowCollection, string)
Get whether the dialog is active based on its title.
Declaration
protected bool IsDialogActiveByTitle(WindowCollection dialogs, string title)
Parameters
dialogs
The list of dialogs to check.
title
The title to check for.
Returns
True/False whether the dialog is active or not.
IsDialogActiveByTitle(WindowCollection, string, bool)
Get whether the dialog is active base on its title.
Declaration
protected bool IsDialogActiveByTitle(WindowCollection dialogs, string title, bool partialTitle)
Parameters
dialogs
The list of dialogs to check.
title
The title to check for.
partialTitle
True/False whether to do partial match or not.
Returns
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
protected bool IsDialogActiveByTitleAndTextContent(WindowCollection dialogs, string title, bool partialTitle, string childWindowTextContent)
Parameters
dialogs
The list of dialogs to check.
title
The title to check for.
partialTitle
True/False whether to do partial match or not.
childWindowTextContent
The partial content of a child window
Returns
True/False whether the dialog is active or not.
IsRejectedViaRegexOrExactMatch(string, object)
Check if rejected via regex or exact match.
MatchesUIAutomationElement(AutomationElement)
Matches UI automation element.
Declaration
public virtual bool MatchesUIAutomationElement(AutomationElement element)
Parameters
element
The element to check against.
Returns
Implements
OnBeforeHandle(EventArgs)
Invoked before dialog is handled.
Declaration
protected virtual void OnBeforeHandle(EventArgs args)
Parameters
args
Event arguments.
ResetHandleCount()
Resets the handle count back to zero.
Declaration
public void ResetHandleCount()
SetDialogWindow(Window)
Set the dialog window.
Declaration
protected void SetDialogWindow(Window dialogWindow)
Parameters
dialogWindow
The dialog window object.
ToString()
Returns a string that represents the current object.
ValidatePaths(string, out string)
Validates paths for read permissions. In case of error returns false and sets an error message.
Declaration
protected bool ValidatePaths(string filePathsToSet, out string error)
Parameters
filePathsToSet
File paths separated with space and wrapped in double quotes.
error
An error message. In case of success it will be set to empty string.
Returns
True if read access is available for all paths.
ValidatePid(int)
Make sure specified pid belongs to either active application or active browser;
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
protected bool ValidateReadFileAccess(string filePath, string dialogName, out string error)
Parameters
filePath
The path to file to check.
dialogName
The name of the dialog which requires the read access.
error
An error message. In case of success it will be set to empty string.
Returns
True if read access is available
WaitUntilAnyHandled(IEnumerable<BaseDialog>, int, long, bool)
Wait untill any dialog is handles.
Declaration
public static void WaitUntilAnyHandled(IEnumerable<BaseDialog> dialogs, int handleCount, long timeoutMilliseconds, bool resetHandleCount = false)
Parameters
dialogs
The dialogs to handle.
handleCount
Handle count.
timeoutMilliseconds
Timeout in milliseconds.
resetHandleCount
Reset handle count.
Exceptions
Thrown when operation times out.
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
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
public void WaitUntilHandled(int timeout)
Parameters
timeout
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
public void WaitUntilHandled(int handleCount, int timeout, bool resetHandleCount)
Parameters
handleCount
The handle count to wait for.
timeout
The time out in milli-seconds to wait for count.
resetHandleCount
True/False whether to reset the handle count before starting.
Events
BeforeHandle
Fired before handling the dialog.