Пример #1
0
        public void setup()
        {
            Shared_Functions.CXALogin("URL", "CompanyId", "Username", "Password", "Browser", "Client");
            Console.WriteLine("Completed Execution");
            string client = ConfigurationManager.AppSettings["Client"];

            Shared_Functions.AccessClient(client);
        }
Пример #2
0
        public void NavigateToStatementOfAccount(string EmpName, int rowvalue)
        {
            Java_ClickElement("xpath", "//a[@rel='FlexBenefitsMenu']", "xpath", "//*[@id='FlexBenefitsMenu']/ul/li[1]/a");
            Thread.Sleep(3000);
            if (driver.FindElement(By.XPath("//*[@id='SelectEmployeePnl']/input")).Displayed)
            {
                driver.FindElement(By.XPath("//*[@id='SelectEmployeePnl']/input")).Click();
            }
            Wait_Until("id", "SearchValue");
            driver.FindElement(By.Id("SearchValue")).SendKeys(EmpName);
            driver.FindElement(By.Id("bthSearch")).Click();
            Wait_Until("XPath", "//*[@id='form1']/table[2]");
            Boolean link = Shared_Functions.IsElementPresent(By.LinkText(EmpName));

            if (link == true)
            {
                driver.FindElement(By.LinkText(EmpName)).Click();
                Wait_Until("id", "PlanYear");
                int count = GetTableCount("XPath", "//*[@id='form1']/div[3]/table[2]");
                Console.WriteLine("Table count is: " + count);
                for (int i = 1; i <= count; i++)
                {
                    for (int j = 1; j < 8; j++)
                    {
                        String FieldName = ExcelLib.ReadValues(1, j);
                        Console.WriteLine("Field name is " + FieldName);
                        String Id_value = ExcelLib.ReadValues(2, j);
                        Id_value = Id_value.Replace("row", "" + (i + 2));
                        Console.WriteLine("Id_value name is " + Id_value);
                        string value = driver.FindElement(By.XPath(Id_value)).Text;
                        Console.WriteLine("Captured value is " + value);


                        if (FieldName.ToLower() == "click_link")
                        {
                            driver.FindElement(By.XPath(Id_value)).Click();
                            Thread.Sleep(3000);
                            Console.WriteLine("no of windows are " + driver.WindowHandles.Count);
                            driver.SwitchTo().Window(driver.WindowHandles.Last());
                        }

                        else
                        {
                            WriteToExcel(Excelpath, 1, rowvalue, j + 1, value);
                        }
                    }
                }
                driver.FindElement(By.XPath("//input[@value='Close']")).Click();
                Thread.Sleep(2000);
                driver.SwitchTo().Window(driver.WindowHandles.FirstOrDefault());
                Thread.Sleep(5000);
                //  Logout();
                //driver.FindElement(By.XPath("//input[contains(value(),'Administer')]")).Click();
                Console.WriteLine("Switched to default");
                driver.FindElement(By.XPath("//*[@id='SelectEmployeePnl']/input")).Click();
                Wait_Until("id", "bthSearch");
            }
            else
            {
                Console.WriteLine("Employee Name: " + EmpName + " Not Found.Please verify");
            }
        }