public override EnumActionResult Execute() { string column = _vm.variables.Get(m_params[1]); string value = _vm.variables.Get(m_params[3]); string[] columns = column.Split('|'); string[] values = value.Split('|'); bool[] founds = new bool[columns.Length]; ControlGrid grd = _vm.GetGrid(); List <Dictionary <string, string> > rows = grd.Rows; int i = 0; foreach (Dictionary <string, string> item in rows) { for (int j = 0; j < founds.Length; ++j) { founds[j] = false; } int colIndex = 0; foreach (string col in columns) { if (!item.ContainsKey(col)) { _vm.host.WriteLog("Column '" + col + "' NOT found."); return(EnumActionResult.ERROR); } if (values[colIndex] == item[col]) { _vm.host.WriteLog("Item '" + item[col] + "' found in column '" + columns[colIndex] + "'"); founds[colIndex] = true; } ++colIndex; } bool found = false; for (int k = 0; k < founds.Length; ++k) { found = founds[k]; } if (found) { _vm.host.UpdateMarker(grd.aeRows[i].Current.BoundingRectangle); _vm.host.aeCurrent = grd.aeRows[i]; AutomationPattern.ScrollIntoView(_vm.host.aeCurrent); _vm.host.aeCurrent.SetFocus(); return(EnumActionResult.TEST_OK); } ++i; } _vm.host.WriteLog("Item NOT found."); return(EnumActionResult.TEST_FAILED); }
public override EnumActionResult Execute() { try { string key = string.Empty; int indexToFind = int.Parse(_vm.variables.Get(m_params[1])); ControlGrid grd = _vm.GetGrid(); if (indexToFind >= grd.aeRows.Count) { _vm.host.WriteLog("GetCellValue Requested index is greater [" + indexToFind + "] than number of rows is: " + grd.aeRows.Count); return(EnumActionResult.ERROR); } _vm.host.aeCurrent = grd.aeRows[indexToFind]; _vm.host.UpdateMarker(_vm.host.aeCurrent.Current.BoundingRectangle); AutomationPattern.ScrollIntoView(_vm.host.aeCurrent); _vm.host.aeCurrent.SetFocus(); key = _vm.variables.Get(m_params[3]); Dictionary <string, string> dic = grd.Rows[indexToFind]; AutomationElement row = grd.aeRows[indexToFind]; AutomationElementCollection cells = row.FindAll(TreeScope.Children, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Text)); int j = 0; foreach (string k in dic.Keys) { if (k == key) { string value = cells[j].Current.Name; _vm.variables.Update(m_params[5], value); return(EnumActionResult.OK); } ++j; } _vm.host.WriteLog("GetCellValue Column [" + key + "] NOT found"); return(EnumActionResult.ERROR); } catch (Exception) { throw; } }
public override EnumActionResult Execute() { try { AutomationPattern.ScrollIntoView(_vm.host.aeCurrent); Thread.Sleep(10); } catch (System.Exception ex) { _vm.host.WriteLog(ex.Message); return(EnumActionResult.ERROR); } return(EnumActionResult.OK); }
public override EnumActionResult Execute() { try { string key = string.Empty; int indexToFind = int.Parse(_vm.variables.Get(m_params[1])); ControlGrid grd = _vm.GetGrid(); _vm.host.aeCurrent = grd.aeRows[indexToFind]; _vm.host.UpdateMarker(_vm.host.aeCurrent.Current.BoundingRectangle); AutomationPattern.ScrollIntoView(_vm.host.aeCurrent); _vm.host.aeCurrent.SetFocus(); AutomationElement row = grd.aeRows[indexToFind]; AutomationElementCollection cells = row.FindAll(TreeScope.Children, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Text)); key = _vm.variables.Get(m_params[3]); Dictionary <string, string> dic = grd.Rows[indexToFind]; int j = 0; foreach (string k in dic.Keys) { if (k == key) { UtilAutomation.ClickOn(cells[j].Current.BoundingRectangle, true); UtilSys.Wait(500); string value = _vm.variables.Get(m_params[5]); value += "+{ENTER}"; System.Windows.Forms.SendKeys.SendWait(value); return(EnumActionResult.OK); } ++j; } return(EnumActionResult.ERROR); } catch (Exception) { throw; } }
public override EnumActionResult Execute() { try { int indexToFind = int.Parse(_vm.variables.Get(m_params[1])); ControlGrid grd = _vm.GetGrid(); _vm.host.aeCurrent = grd.aeRows[indexToFind]; _vm.host.UpdateMarker(_vm.host.aeCurrent.Current.BoundingRectangle); AutomationPattern.ScrollIntoView(_vm.host.aeCurrent); _vm.host.aeCurrent.SetFocus(); return(EnumActionResult.TEST_OK); } catch (Exception) { throw; } }