/// <summary> /// Selects all rows /// <param name="dataGrid">UI data grid</param> /// <returns>true if row selection sucessfull</returns> /// </summary> public bool SelectDataGridAllRows(bool selectAll) { var parent = QAUIItem.GetParent(UIItem, "parent"); var container = QAContainer.Get(SearchCriteria.ByAutomationId(parent.UIItem.Id), "container"); var gotoRowTextBox = QATextBox.Get(SearchCriteria.ByAutomationId("dataGridGoToRow"), "(Hidden) GoToRow", container.UIItem); if (gotoRowTextBox != null && gotoRowTextBox.Exists) { gotoRowTextBox.UIItem.SetValue(string.Empty); Thread.Sleep(1000); if (selectAll) { gotoRowTextBox.UIItem.SetValue("all"); } else { gotoRowTextBox.UIItem.SetValue("none"); } return(true); } if (selectAll) { Report.Output("FAILURE: Failed to select all rows"); } else { Report.Output("FAILURE: Failed to unselect all rows"); } return(false); }
/// <summary> /// Copies data to the clipboard from the grid using data grid instead of keyboard shortcut CTRL-C /// </summary> /// <returns>bool to indicate whether grid based copy was possible</returns> private bool CopyGridToClipboardAsCSV(Window window) { var parent = QAUIItem.GetParent(UIItem, "parent"); var container = QAContainer.Get(SearchCriteria.ByAutomationId(parent.UIItem.Id), "container"); var copyToClipboard = QATextBox.Get(SearchCriteria.ByAutomationId("dataGridCopyToClipboardCSV"), "copyToClipboard", container.UIItem); if (copyToClipboard.Exists) { copyToClipboard.SetValue("1", false); return(true); } Report.Output("FAILURE: unable to copy to clipboard"); return(false); }
/// <summary> /// Sets UI to a specific row /// <param name="dataGrid">UI data grid</param> /// <returns>true if row found</returns> /// </summary> public bool SelectMultipleDataGridRows(List <int> zeroBasedTargetRows) { var parent = QAUIItem.GetParent(UIItem, "parent"); var container = QAContainer.Get(SearchCriteria.ByAutomationId(parent.UIItem.Id), "container"); var gotoRowTextBox = QATextBox.Get(SearchCriteria.ByAutomationId("dataGridGoToRow"), "(Hidden) GoToRow", container.UIItem); if (gotoRowTextBox != null && gotoRowTextBox.Exists) { gotoRowTextBox.UIItem.SetValue(string.Empty); Thread.Sleep(1000); gotoRowTextBox.UIItem.SetValue(string.Join(",", zeroBasedTargetRows)); return(true); } Report.Output("FAILURE: Row not found"); return(false); }