public static List<string> GetValue(string controlString, int rowNumber) { _control = new WatinControlStringHandler(controlString); SetDocument(); SetTable(_control.TableDefinition); List<string> rowData = new List<string>(); for (int i = 0; i < _table.TableCells.Count; i++) { rowData.Add(CellHandler.GetValue(controlString, i, rowNumber).Trim()); } return rowData; }
public static List<string> GetValue(string controlString, int columnNumber) { _control = new WatinControlStringHandler(controlString); SetDocument(); SetTable(_control.TableDefinition); return GetValue(controlString, columnNumber, false); }
//The include header is still not functioning properly now public static List<string> GetValue(string controlString, int columnNumber, bool includeHeaderRow) { _control = new WatinControlStringHandler(controlString); SetDocument(); SetTable(_control.TableDefinition); List<string> columnData = new List<string>(); int startingRow = (includeHeaderRow) ? 0 : 1; for (int i = startingRow; i < _table.TableRows.Count; i++) { columnData.Add(CellHandler.GetValue(controlString, columnNumber, i).Trim()); } return columnData; }
public static void Invoke(string controlString, int columnNumber, int rowNumber) { _control = new WatinControlStringHandler(controlString); SetDocument(); SetTable(_control.TableDefinition); switch (_control.ControlType) { case "button": case "submit": case "input": if (_control.WaitForComplete) { _table.TableRows[rowNumber].TableCells[columnNumber].Buttons[0].Click(); } else { _table.TableRows[rowNumber].TableCells[columnNumber].Buttons[0].ClickNoWait(); } break; case "link": _table.TableRows[rowNumber].TableCells[columnNumber].Links[0].Click(); break; default: throw new NotImplementedException("The control type has not been implemented in Stax.Controller.Watin.Table Controller.Invoke"); } }
//public static string GetValue(string controlString, string columnName, string rowName) //{ // return "fix me please ..."; //} //public void Invoke(string controlString, string columnName, string rowName) //{ //} public static void Invoke(string controlString, int columnNumber, string nameToClick) { _control = new WatinControlStringHandler(controlString); SetDocument(); SetTable(_control.TableDefinition); switch (_control.ControlType) { case "link": _table.TableCells[columnNumber].Link(Find.By("innertext", nameToClick)).Click(); break; default: throw new NotImplementedException("The control type has not been implemented in Stax.Controller.Watin.Table Controller.Invoke"); } }
//public bool findValue(string controlString, int columnNumber, string valueToSearch) //{ // _control = new ControlStringHandler(controlString); // SetDocument(); // SetTable(_control.TableDefinition); // bool found = false; //} public static string GetValue(string controlString, int columnNumber, int rowNumber) { _control = new WatinControlStringHandler(controlString); SetDocument(); SetTable(_control.TableDefinition); string returnValue = null; foreach (WatiN.Core.Element ele in _table.TableRows[rowNumber].Elements) { if (ele.TagName == "TH") { returnValue = (ele.Text); } } if (returnValue == null) { if (_table.TableRows[rowNumber].TableCells[columnNumber].Text == null) { returnValue = ""; } else { returnValue = _table.TableRows[rowNumber].TableCells[columnNumber].Text; } } return returnValue; }
public static bool DoesValueExist(string controlString, String value) { _control = new WatinControlStringHandler(controlString); if (_control.WaitForComplete) { _ie.WaitForComplete(); } WaitForAsyncPostBackToComplete(); SetDocument(); bool returnValue = false; switch (_control.ControlType) { case "select": if (_document.SelectList(_control.WatinAttribute).Option(value).Exists) { returnValue = true; } else { // Give a guy a second chance System.Threading.Thread.Sleep(500); returnValue = _document.SelectList(_control.WatinAttribute).Option(value).Exists; } break; default: throw new NotImplementedException( "The control type has not been implemented in Stax.Controller.Watin.DoesValueExist"); } _document = BrowserController.DomContainer; return returnValue; }
private static void WebActionSetUp(string controlString) { _control = new WatinControlStringHandler(controlString); if (_control.WaitForComplete) { _ie.WaitForComplete(); } WaitForAsyncPostBackToComplete(); SetDocument(); if (!string.IsNullOrEmpty(_control.CSSSelector)) { } }