public static List <IWebElement> FindCellsOfColumnByColumnName(string columnHeaderText) { List <IWebElement> allColumns = EditMarksGridHelper.FindAllColumns(); IWebElement ageColumn = allColumns.FirstOrDefault(col => col.Text.Contains(columnHeaderText)); string columnNo = ageColumn.GetAttribute("column"); return(EditMarksGridHelper.FindcellsForColumn(columnNo)); }
public static void ScrollToRight(string columnNo) { List <IWebElement> editableCells = EditMarksGridHelper.FindAllEditablecells(); Actions action = new Actions(WebContext.WebDriver); if (editableCells.Any(cell => cell.GetAttribute("column") == columnNo)) { editableCells.Find(cell => cell.GetAttribute("column") == columnNo).Click(); action.SendKeys(Keys.Right); } else { string lastColNo = editableCells.LastOrDefault().GetAttribute("column"); editableCells.LastOrDefault().Click(); for (int i = Convert.ToInt16(lastColNo); i < Convert.ToInt16(columnNo); i++) { action.SendKeys(Keys.Right).Perform(); } } }