/// <summary> /// Checks the text of the specified ResourceId for the specified text value. /// </summary> /// <param name="resourceId">The resource identifier.</param> /// <param name="text">The text to search for.</param> /// <returns>true if the text is equal.</returns> public bool ExistTextOnResourceId(string resourceId, string text) { UiSelector uiSelector = new UiSelector().ResourceId(resourceId); bool exist = _controller.GetText(uiSelector).Equals(text); return(exist); }
/// <summary> /// Set Filename of scan output /// </summary> /// <param name="fileName">File name to set</param> /// <param name="resourceId">Ui selector resource id to insput file name</param> public void SetFileName(string fileName, string resourceId = null) { if (!_controller.DoesScreenContains(new UiSelector().ResourceId($"{_packageName}:id/bt_hide_options"))) { throw new DeviceWorkflowException("App screen is not on the option setting"); } if ("Hide Options".Equals(_controller.GetText(new UiSelector().ResourceId($"{_packageName}:id/bt_hide_options")))) { _controller.Click(new UiSelector().ResourceId($"{_packageName}:id/bt_hide_options")); } if (System.String.IsNullOrEmpty(resourceId)) { if (!_controller.SetText(new UiSelector().ResourceId($"{_packageName}:id/editTextDescription"), fileName)) { throw new DeviceWorkflowException($"File name setting failed to {fileName}"); } } else { if (!_controller.SetText(new UiSelector().ResourceId($"{_packageName}:id/{resourceId}"), fileName)) { throw new DeviceWorkflowException($"File name setting failed to {fileName}"); } } }
private void EnterUserName() { UiSelector userNameSelector = new UiSelector().ResourceId("username"); string userNametext = _controller.GetText(userNameSelector); if (string.IsNullOrEmpty(userNametext)) { OnStatusUpdate("Enter user name."); if (!_controller.SetText(userNameSelector, Credential.UserName)) { throw new DeviceWorkflowException("Failed to enter user name."); } } UiSelector rememberSelector = new UiSelector().ResourceId("RememberMe"); if (!_controller.IsChecked(rememberSelector)) { OnStatusUpdate("Set 'Remember Me' checkbox."); _controller.Click(rememberSelector); } }