示例#1
0
 public void SetEmployeeName(string employeeName)
 {
     SwitchToFrame();
     EmployeeName.Clear();
     EmployeeName.SendKeys(employeeName);
     SwitchToParent();
     driver.SwitchTo().Frame("noncoreIframe");
     Employee.Click();
     SwitchToParent();
 }
        public EmployeeResultInformationPage SearchForEmployeeName(string employeeName)
        {
            Console.WriteLine("Find for the form to search");
            Utils.FindElementVisible(By.Id("empsearch_employee_name_empName"));
            Console.WriteLine("Fill employeeName value: " + employeeName);
            EmployeeName.SendKeys(employeeName);

            Console.WriteLine("Click on Search button");
            ButtonSearch.Click();
            return(new EmployeeResultInformationPage());
        }
示例#3
0
        public string AddUser(UserRole role, string employeeName, string userName, Status status, string password)
        {
            SelectElement select = new SelectElement(Role);

            select.SelectByText(role.ToString());

            EmployeeName.Clear();
            EmployeeName.SendKeys(employeeName);

            UserName.Clear();
            UserName.SendKeys(userName);

            select = new SelectElement(Status);
            select.SelectByText(status.ToString());

            Password.Clear();
            Password.SendKeys(userName);

            ConfirmPassword.Clear();
            ConfirmPassword.SendKeys(userName);

            SaveBtn.Click();

            try
            {
                return(string.Format("Error validating employee name: {0}", EmpNameValidationError.Text));
            }
            catch (NoSuchElementException) { }

            try
            {
                return(string.Format("Error validating user name: {0}", UsrNameValidationError.Text));
            }
            catch (NoSuchElementException) { }

            return("Success");
        }
示例#4
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");
        }