public static IWebElement FindColumnByColumnName(string columnName) { List <IWebElement> allColumns = MarksheetGridHelper.FindAllColumns(); IWebElement getColumn = allColumns.FirstOrDefault(col => col.Text.Contains(columnName)); return(getColumn); }
public static String GetColumnName(string columnHeaderText) { List <IWebElement> allColumns = MarksheetGridHelper.FindAllColumns(); IWebElement ageColumn = allColumns.FirstOrDefault(col => col.Text.Contains(columnHeaderText)); String ColumnName = ageColumn.GetText(); return(ColumnName); }
public static List <IWebElement> FindCellsOfColumnByColumnNamePOSExpectation(string columnHeaderText, string columnHeaderFooterText) { List <IWebElement> allColumns = MarksheetGridHelper.FindAllColumns(); IWebElement ageColumn = allColumns.FirstOrDefault(col => col.Text.Contains(columnHeaderText)); string columnNo = ageColumn.GetAttribute("column"); return(MarksheetGridHelper.FindcellsForColumn(columnNo)); }
public static List <IWebElement> FindCellsOfColumnByColumnNameForPOS(string columnHeaderText) { string textTocompare = columnHeaderText.Replace(" ", string.Empty).ToLower(); List <IWebElement> allColumns = MarksheetGridHelper.FindAllColumns(); IWebElement ageColumn = allColumns.FirstOrDefault(col => col.Text.Replace(" ", string.Empty).ToLower().StartsWith(textTocompare)) ?? allColumns.FirstOrDefault(col => col.Text.Replace(" ", string.Empty).ToLower().Contains(textTocompare)); string columnNo = ageColumn.GetAttribute("column"); return(MarksheetGridHelper.FindcellsForColumn(columnNo)); }
//to multiple cells public FormulaBarPage AddValueToColumn(string columnName, string value) { List <IWebElement> allColumns = MarksheetGridHelper.FindAllColumns(); IWebElement column = allColumns.FirstOrDefault(col => col.Text == columnName); string columnNo = column != null?column.GetAttribute("column") : "1"; MarksheetGridHelper.FindColumnByColumnNumber(columnNo).Click(); Actions action = new Actions(WebContext.WebDriver); _formulaBarElement.Click(); _formulaBarElement.Clear(); _formulaBarElement.SendKeys(value); action.SendKeys(Keys.Enter).Perform(); return(this); }
public FormulaBarPage AddValue(string columnName, string value) { List <IWebElement> allColumns = MarksheetGridHelper.FindAllColumns(); IWebElement column = allColumns.FirstOrDefault(col => col.Text == columnName); string columnNo = column != null?column.GetAttribute("column") : "1"; List <IWebElement> editableCellsforColumn = MarksheetGridHelper.FindcellsForColumn(columnNo); if (editableCellsforColumn != null && editableCellsforColumn.Count > 0) { Actions action = new Actions(WebContext.WebDriver); editableCellsforColumn.First().Click(); _formulaBarElement.Click(); _formulaBarElement.Clear(); _formulaBarElement.SendKeys(value); action.SendKeys(Keys.Enter).Perform(); } return(this); }
public FormulaBarPage AddComment(string columnName, string value, bool haveToClick) { List <IWebElement> allColumns = MarksheetGridHelper.FindAllColumns(); IWebElement column = allColumns.FirstOrDefault(col => col.Text == columnName); string columnNo = column != null?column.GetAttribute("column") : "1"; List <IWebElement> editableCellsforColumn = MarksheetGridHelper.FindcellsForColumn(columnNo); if (editableCellsforColumn != null && editableCellsforColumn.Count > 0) { Actions action = new Actions(WebContext.WebDriver); editableCellsforColumn.First().WaitUntilState(ElementState.Enabled); if (haveToClick) { editableCellsforColumn.First().Click(); } _commentBarElement.Click(); _commentBarElement.WaitUntilState(ElementState.Enabled); _commentBarElement.Clear(); if (value.Length > 500) { _commentBarElement.SendKeys(value.Substring(0, 500)); _commentBarElement.SendKeys(value.Substring(500, (value.Length - 500))); } else { _commentBarElement.SendKeys(value); } action.SendKeys(Keys.Enter).Perform(); } return(this); }