Пример #1
0
        public string DeleteAttendanceRecord(string employeeName, string date)
        {
            List <string> records;

            ViewAttendanceRecord(employeeName, date, out records);

            IList <IWebElement> tableRows = ResultTable.FindElements(By.TagName("tr"));

            foreach (var row in tableRows)
            {
                if (row.Text.Contains(employeeName) & row.Text.Contains(date))
                {
                    IWebElement checkBox = row.FindElement(By.Name("chkSelectRow[]"));

                    if (!checkBox.Selected)
                    {
                        checkBox.Click();

                        DeleteBtn.Click();

                        OkBtn.Click();

                        return("Success");
                    }
                }
            }

            return("No Record Found");
        }
Пример #2
0
        public string ViewAttendanceRecord(string employeeName, string date, out List <string> records)
        {
            records = new List <string>();
            EmployeeName.Clear();
            EmployeeName.SendKeys(employeeName);

            Date.Clear();
            Date.SendKeys(date);

            ViewBtn.Click();

            try
            {
                return(ValidationError.Text);
            }
            catch (NoSuchElementException) { }

            IList <IWebElement> tableRows = ResultTable.FindElements(By.TagName("tr"));

            if (tableRows.Count < 2)
            {
                return("No Records Found");
            }

            if (tableRows[1].Text == "No Records Found" | tableRows[1].Text.Contains("No attendance records to display"))
            {
                return("No Records Found");
            }

            for (int i = 1; i < tableRows.Count; i++)
            {
                records.Add(tableRows[i].Text);
            }

            return("Success");
        }