/// <summary>
        ///
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="n"></param>
        /// <returns></returns>
        public virtual DataRow[] SelectData(string filter, int n)
        {
            List <DataRow> list = new List <DataRow>();

            TrackAction("TableSelectDataByFilter", filter, n);
            if (!EnvManager.Auto)
            {
                return(null);
            }
            DataTable table = GetPageData();

            if (table.Rows.Count > 0)
            {
                if (n > table.Rows.Count)
                {
                    throw new IndexOutOfRangeException($"There are not {n} data in the table.");
                }
                DataRow[] rows = table.Select(filter);
                int       i    = 0;
                foreach (DataRow row in rows)
                {
                    int index = table.Rows.IndexOf(row);
                    SolutionLocator.LocateElement(new By[] { By.CssSelector($"table tbody tr:nth-child({Math.Max(0, index)}) td:nth-child({CheckboxColumnIndex})") }).Click();
                    i++;
                    list.Add(row);
                    if (i >= n)
                    {
                        break;
                    }
                }
            }
            return(list.ToArray());
        }
 /// <summary>
 /// 从表中找出对应条件的数据,并点击对应列的单元格
 /// </summary>
 /// <param name="filter"></param>
 /// <param name="colName"></param>
 /// <returns></returns>
 public WebTable ClickCell(string filter, string colName)
 {
     TrackAction("TableClickCell", filter, colName);
     if (!EnvManager.Auto)
     {
         return(this);
     }
     DataRow[] rows = FindData(filter);
     foreach (var row in rows)
     {
         int index    = table.Rows.IndexOf(row);
         int colIndex = table.Columns.IndexOf(colName);
         SolutionLocator.LocateElement(new By[] { By.CssSelector($"table tbody tr:nth-child({index + 1}) td:nth-child({colIndex + 1})") }).Click();
     }
     return(this);
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public virtual DataRow SelectData(int index)
        {
            DataTable table = GetPageData();

            TrackAction("TableSelectDataByIndex", index);
            if (!EnvManager.Auto)
            {
                return(null);
            }
            if (table.Rows.Count > 0)
            {
                if (index > table.Rows.Count)
                {
                    throw new IndexOutOfRangeException($"There are not {index} data in the table.");
                }
                SolutionLocator.LocateElement(new By[] { By.CssSelector($"table tbody tr:nth-child({Math.Max(1, index)}) td:nth-child({CheckboxColumnIndex})") }).Click();
                return(table.Rows[Math.Max(0, index - 1)]);
            }
            return(null);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        public virtual DataRow[] SelectAllData(string filter)
        {
            TrackAction("TableSelectAllDataByFilter", filter);
            if (!EnvManager.Auto)
            {
                return(null);
            }
            DataTable table = GetPageData();

            if (table.Rows.Count > 0)
            {
                DataRow[] rows = table.Select(filter);
                foreach (DataRow row in rows)
                {
                    int index = table.Rows.IndexOf(row);
                    SolutionLocator.LocateElement(new By[] { By.CssSelector($"table tbody tr:nth-child({Math.Max(0, index)}) td:nth-child({CheckboxColumnIndex})") }).Click();
                }
                return(rows);
            }
            return(null);
        }
        /// <summary>
        /// 对于表中符合条件的数据,勾选给定字段
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="fields"></param>
        /// <returns></returns>
        public WebTable Tick(string filter, params string[] fields)
        {
            TrackAction("TableTickFields", filter, string.Join(", ", fields));
            if (!EnvManager.Auto)
            {
                return(this);
            }
            DataRow[]  rows         = FindData(filter);
            List <int> colIndexList = new List <int>();

            foreach (string field in fields)
            {
                colIndexList.Add(table.Columns.IndexOf(field) + 1);
            }
            foreach (var row in rows)
            {
                int index = table.Rows.IndexOf(row);
                foreach (int colIndex in colIndexList)
                {
                    SolutionLocator.LocateElement(new By[] { By.CssSelector($"table tbody tr:nth-child({index + 1}) td:nth-child({colIndex})") }).Tick();
                }
            }
            return(this);
        }