Control Class

This class represents windows objects and is returned by calls to FindTopWindow, FindTopWindows, FindControl, FindControls and WindowFromPoint.

Controls can be windows, dialogs, buttons, comboBoxes or any other windows object that can be identified by a unique window handle.

Control objects interact with the windows object using the Microsoft Windows API methods.  It has a low overhead and finding Controls using the Find methods is fast.

For an overview of the Microsoft Windows system see

The WinDriver Control class mainly uses Windows functions and messages described in to operate on widows identified by the window handle.  For brave programmers you can use the window handle to call and of the Microsoft windows functions directly within the script.

Some windows UI components such as status bar fields, non-standard or components build from Microsoft WCF or Silverlight are not visible as Control objects. In that case you can try using the AutomationControl Class class

Control Class Properties

Property Description

string text

The control's text value such as the window caption or label.  Note that some controls may not have a label.

System.Drawing.Point Center

The center of the window

bool Enabled

True if the windows control is enabled

bool Visible

True if the windows control is enabled

HandleRef Handle

The windows handle

int Height, Width

The control height and width

Point p

Defined in System.Drawing.Point. A Class to encapsulate the X & Y coordinates.

int X, Y

The control's top left hand X and Y coordinates

int DefaultMaxWait

The default maximum time in milliseconds that time limited methods will wait e.g. FindControl, FindTopWindow and WaitForWindowVisible and other WaitFor... methods.

string class

The windows class name.

Point Centre

The point at the centre of the window

The Control class MetaData

using System;

using System.Collections.Generic;

using System.Drawing;

using System.Runtime.InteropServices;

using System.Windows.Automation;


namespace Facilita.Fc.WinDriver


public abstract class BaseControl : IControl


protected BaseControl(WinDriverVirtualUser vu);

public abstract string AutomationId { get; }

public Point Centre { get; }

public abstract string Class { get; }

public abstract ControlType ControlType { get; }

public abstract bool Enabled { get; }

public abstract HandleRef Handle { get; }

public int Height { get; }

public abstract Rectangle Rectangle { get; }

public abstract string Text { get; }

public abstract bool Visible { get; }

protected WinDriverVirtualUser VU { get; }

public int Width { get; }

public int X { get; }

public int Y { get; }


public abstract void ActivateMenuItem(params string[] menuItemPath);

public abstract void ClickButton();

public void DoubleLeftClick();

public abstract void DoubleLeftClick(int moveRight, int moveDown);

public abstract void ExpandTreeItem(string name);

public abstract IList<string> GetComboBoxItems();

public abstract IList<string> GetListBoxItems();

public abstract int GetListItemCount();

public abstract Point GetListItemLocation(int index);

public abstract Point GetTreeItemLocation(string name);

public abstract Rectangle GetTreeItemRectangle(string name);

public abstract string GetTreeItemText(int index);

public abstract int GetTreeViewItemCount();

public void LeftClick();

public abstract void LeftClick(int moveRight, int moveDown);

public void LeftClickBelowRHS();

public void LeftClickBelowRHS(int moveLeft, int moveDown);

public void LeftClickLHS();

public void LeftClickLHS(int moveRight, int moveDown);

public void LeftClickRHS();

public void LeftClickRHS(int moveLeft, int moveDown);

public void RightClick();

public abstract void RightClick(int moveRight, int moveDown);

public void RightClickLHS();

public void RightClickLHS(int moveRight, int moveDown);

public void SaveBitmap(string pathName);

public abstract void SelectComboBoxItem(int item);

public abstract void SelectComboBoxItem(string item);

public abstract void SelectListBoxItem(int item);

public abstract void SelectListBoxItem(string item);

public abstract void SelectTreeItem(string name);

public void SetCursorPosBottomRHS();

public void SetCursorPosBottomRHS(int moveLeft, int moveUp);

public void SetCursorPosTopLHS();

public void SetCursorPosTopLHS(int moveRight, int moveDown);

public abstract void SetForegroundWindow();

public void Terminate();

public void WaitForWindowCount(string wantedClass, int count);

public abstract void WaitForWindowCount(string wantedClass, int count, int maxWait);

public void WaitForWindowEnabled();

public void WaitForWindowEnabled(int maxWait);

public void WaitForWindowVisible();

public void WaitForWindowVisible(int maxWait);

public void WaitWhileWindowVisible();

public void WaitWhileWindowVisible(int maxWait);




This topic was last updated on June 10, 2020, at 03:02:15 PM.

Eggplant icon | Documentation Home | User Forums | Support | Copyright © 2021 Eggplant