Skip to content

Service UI

MilleBo edited this page Mar 3, 2017 · 1 revision

Access the adb service through the device class, for example:

var uiObject = device.Ui.CreateUiObject(With.Text("text");

All available ui methods

/// <summary>
/// Gets a list of ui extensions
/// </summary>
IList<IUiExtension> Extensions { get; }

/// <summary>
/// Find a node on the screen
/// </summary>
/// <param name="timeout">Timeout in seconds</param>
/// <param name="with">Find node with</param>
/// <returns>Returns found node</returns>
/// <exception cref="UiNodeNotFoundException">If we timeout and can't find the node</exception>
Node FindNode(int timeout, params With[] with);

/// <summary>
/// Find multiple nodes on the screen
/// </summary>
/// <param name="timeout">Timeout in seconds</param>
/// <param name="with">Find node with</param>
/// <returns>Returns found node</returns>
/// <exception cref="UiNodeNotFoundException">If we timeout and can't find any nodes</exception>
IList<Node> FindNodes(int timeout, params With[] with);

/// <summary>
/// Create a new ui object that wraps around a node that match a specific search critiera
/// </summary>
/// <param name="with">Find node with</param>
/// <returns>The mapped ui object</returns>
UiObject CreateUiObject(params With[] with);

/// <summary>
/// Create a new ui object that wraps around multiple nodes that match a specific search critiera
/// </summary>
/// <param name="with">Find nodes with</param>
/// <returns>The mapped ui object</returns>
UiObjects CreateUiObjects(params With[] with);

/// <summary>
/// Start the UI server
/// </summary>
/// <exception cref="UiAutomatorServerException">Thrown if we can't server</exception>
void StartUiServer();

/// <summary>
/// Stop the UI server
/// </summary>
void StopUiServer();
Clone this wiki locally