Exemplo n.º 1
0
        private void selectStartDateAndTime()
        {
            StartDateDropDown.setDate(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate"));

            GlobalDefinitions.wait(20);

            EndDateDropDown.setDate(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate"));


            string weekDay = GlobalDefinitions.ExcelLib.ReadData(2, "Selectday");

            switch (weekDay)
            {   //MOnday is default value
            case "Sun":
                Days.FindElement(By.XPath("//div[2]/descendant::input[@index='0' and @name='Available']")).Click();
                Days.FindElement(By.XPath("//div[2]/descendant::input[@index='0' and @name='StartTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                Days.FindElement(By.XPath("//div[2]/descendant::input[@index='0' and @name='EndTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
                break;

            case "Tue":
                Days.FindElement(By.XPath("//div[4]/descendant::input[@index='2' and @name='Available']")).Click();
                Days.FindElement(By.XPath("//div[4]/descendant::input[@index='2' and @name='StartTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                Days.FindElement(By.XPath("//div[4]/descendant::input[@index='2' and @name='EndTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
                break;

            case "Wed":
                Days.FindElement(By.XPath("//div[5]/descendant::input[@index='3' and @name='Available']")).Click();
                Days.FindElement(By.XPath("//div[5]/descendant::input[@index='3' and @name='StartTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                Days.FindElement(By.XPath("//div[5]/descendant::input[@index='3' and @name='EndTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
                break;

            case "Thu":
                Days.FindElement(By.XPath("//div[6]/descendant::input[@index='4' and @name='Available']")).Click();
                Days.FindElement(By.XPath("//div[6]/descendant::input[@index='4' and @name='StartTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                Days.FindElement(By.XPath("//div[6]/descendant::input[@index='4' and @name='EndTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
                break;

            case "Fri":
                Days.FindElement(By.XPath("//div[7]/descendant::input[@index='5' and @name='Available']")).Click();
                Days.FindElement(By.XPath("//div[7]/descendant::input[@index='5' and @name='StartTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                Days.FindElement(By.XPath("//div[7]/descendant::input[@index='5' and @name='EndTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
                break;

            case "Sat":
                Days.FindElement(By.XPath("//div[8]/descendant::input[@index='6' and @name='Available']")).Click();
                Days.FindElement(By.XPath("//div[8]/descendant::input[@index='6' and @name='StartTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                Days.FindElement(By.XPath("//div[8]/descendant::input[@index='6' and @name='EndTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
                break;

            default:
                Days.FindElement(By.XPath("//div[3]/descendant::input[@index='1' and @name='Available']")).Click();
                Days.FindElement(By.XPath("//div[3]/descendant::input[@index='1' and @name='StartTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                Days.FindElement(By.XPath("//div[3]/descendant::input[@index='1' and @name='EndTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
                break;
            }
        }