/// <summary> /// Dismisses the the keyboard. /// </summary> /// <param name="appDriver"> /// The <see cref="AppDriver"/> on which to executor the command. /// </param> public static void DismissKeyboard(this AppDriver appDriver) { appDriver.ExecuteCommand(AppDriverCommand.DismissKeyboard, new Dictionary <string, object>() { { AppDriverCommand.SessionId, appDriver.SessionId } }); }
/// <summary> /// Clears the text of the active text field. /// </summary> /// <param name="appDriver"> /// The <see cref="AppDriver"/> on which to executor the command. /// </param> public static void ClearText(this AppDriver appDriver) { appDriver.ExecuteCommand(AppDriverCommand.ClearText, new Dictionary <string, object>() { { AppDriverCommand.SessionId, appDriver.SessionId } }); }
public static Timeouts GetTimeouts(this AppDriver appDriver) { var response = appDriver.ExecuteCommand(AppDriverCommand.GetTimeouts, new Dictionary <string, object>() { { AppDriverCommand.SessionId, appDriver.SessionId } }); return(GetValue <Timeouts>(response)); }
/// <summary> /// Clicks on the device screen on the given absolute coordinate. /// </summary> /// <param name="appDriver"> /// The <see cref="AppDriver"/> on which to execute the command. /// </param> /// <param name="x"> /// The x component of the coordinate. /// </param> /// <param name="y"> /// The y component of the coordinate. /// </param> public static void ClickByCoordinate(this AppDriver appDriver, int x, int y) { appDriver.ExecuteCommand(AppDriverCommand.ClickByCoordinate, new Dictionary <string, object>() { { AppDriverCommand.SessionId, appDriver.SessionId }, { "x", x }, { "y", y } }); }
public static void ScrollToVisible(this AppDriver appDriver, IWebElement element) { var remoteWebElementType = typeof(RemoteWebElement); var elementIdField = remoteWebElementType.GetField("elementId", BindingFlags.Instance | BindingFlags.NonPublic); var elementId = elementIdField.GetValue(element) as string; appDriver.ExecuteCommand(AppDriverCommand.ScrollToVisible, new Dictionary <string, object>() { { AppDriverCommand.SessionId, appDriver.SessionId }, { AppDriverCommand.ElementId, elementId }, }); }
public static void Flick(this AppDriver appDriver, IWebElement element, Direction direction) { var remoteWebElementType = typeof(RemoteWebElement); var elementIdField = remoteWebElementType.GetField("elementId", BindingFlags.Instance | BindingFlags.NonPublic); var elementId = elementIdField.GetValue(element) as string; appDriver.ExecuteCommand(AppDriverCommand.FlickCoordinate, new Dictionary <string, object>() { { "element", elementId }, { "direction", direction } }); }
public static void SetProperty(this AppDriver appDriver, IWebElement element, string name, string value) { var remoteWebElementType = typeof(RemoteWebElement); var elementIdField = remoteWebElementType.GetField("elementId", BindingFlags.Instance | BindingFlags.NonPublic); var elementId = elementIdField.GetValue(element) as string; appDriver.ExecuteCommand(AppDriverCommand.SetProperty, new Dictionary <string, object>() { { AppDriverCommand.SessionId, appDriver.SessionId }, { AppDriverCommand.ElementId, elementId }, { AppDriverCommand.PropertyName, name }, { AppDriverCommand.PropertyValue, value }, }); }
public static object PerformOperation(this AppDriver appDriver, IWebElement webElement, string operation, Collection <object> arguments) { var remoteWebElementType = typeof(RemoteWebElement); var elementIdField = remoteWebElementType.GetField("elementId", BindingFlags.Instance | BindingFlags.NonPublic); var elementId = elementIdField.GetValue(webElement) as string; return(appDriver.ExecuteCommand(AppDriverCommand.PerformOperation, new Dictionary <string, object> { { AppDriverCommand.SessionId, appDriver.SessionId }, { AppDriverCommand.ElementId, elementId }, { "operation", operation }, { "args", arguments } }).Value); }
/// <summary> /// Scrolls until an element with the marked contition is visible. /// </summary> /// <param name="appDriver"> /// The <see cref="AppDriver"/> on which to executor the command. /// </param> /// <param name="element"> /// The element on which to swipe. /// </param> /// <param name="xpath"> /// the xpath condition to stop scrolling. /// </param> public static void ScrollUpTo(this AppDriver appDriver, IWebElement element, string xpath) { var remoteWebElementType = typeof(RemoteWebElement); var elementIdField = remoteWebElementType.GetField("elementId", BindingFlags.Instance | BindingFlags.NonPublic); var elementId = elementIdField.GetValue(element) as string; appDriver.ExecuteCommand(AppDriverCommand.ScrollTo, new Dictionary <string, object>() { { AppDriverCommand.SessionId, appDriver.SessionId }, { AppDriverCommand.ElementId, elementId }, { "value", xpath }, { "using", "xpath" }, { "direction", "Down" } }); }
public static void FlickCoordinate(this AppDriver appDriver, IWebElement element, int x, int y, int xOffset, int yOffset, int speed) { var remoteWebElementType = typeof(RemoteWebElement); var elementIdField = remoteWebElementType.GetField("elementId", BindingFlags.Instance | BindingFlags.NonPublic); var elementId = elementIdField.GetValue(element) as string; appDriver.ExecuteCommand(AppDriverCommand.FlickCoordinate, new Dictionary <string, object>() { { "element", elementId }, { "xCoordinate", x }, { "yCoordinate", y }, { "xoffset", xOffset }, { "yoffset", yOffset }, { "speed", speed }, }); }
/// <summary> /// Checks if the <see cref="AppDriver"/> is ready. /// </summary> /// <param name="appDriver"> /// The <see cref="AppDriver"/> on which to executor the command. /// </param> /// <returns> /// <see langword="true"/> if the <see cref="AppDriver"/> is ready; /// otherwise, returns <see langword="false"/> /// </returns> public static bool IsReady(this AppDriver appDriver) { var response = appDriver.ExecuteCommand(AppDriverCommand.IsReady, new Dictionary <string, object>()); return((bool)response.Value); }
/// <summary> /// Gets the <c>WebDriver</c> status /// </summary> /// <param name="appDriver"> /// The <see cref="AppDriver"/> on which to executor the command. /// </param> /// <returns> /// The <c>WebDriver</c> status /// </returns> public static Status GetStatus(this AppDriver appDriver) { var response = appDriver.ExecuteCommand(AppDriverCommand.GetStatus, string.Empty); return(GetValue <Status>(response)); }