Esempio n. 1
0
        internal void DeleteShareSkill()
        {
            //Thread.Sleep(3000);
            GlobalDefinitions.Wait(3000);
            ManagementListingBtn.Click();
            //Thread.Sleep(2000);
            GlobalDefinitions.Wait(2000);


            try
            {
                //Thread.Sleep(1000);
                GlobalDefinitions.Wait(1000);


                var table = _driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody")); //table

                var manageListRow = table.FindElements(By.TagName("tr")).ToList();                                                   //all rows picked


                var isFound = false;
                // var rows = _driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr"));  //each row and coloum


                for (int i = 1; i <= manageListRow.Count; i++)
                {
                    var row = _driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]")); //each row and coloum

                    var columnList = row.FindElements(By.TagName("td")).ToList();                                                                    //all coloum

                    for (int j = 1; j <= columnList.Count; j++)
                    {
                        var oldManageList = _driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[" + j + "]"));  //each row and coloum

                        //click on edit button with specific row and column

                        if (oldManageList.Text == "Edited Code")
                        {
                            isFound = true;

                            _driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[8]/div/button[3]/i")).Click();   //Delete button
                            //IAlert alert = _driver.SwitchTo().Alert();
                            Thread.Sleep(2000);
                            _driver.FindElement(By.XPath("/html/body/div[2]/div/div[3]/button[2]")).Click();

                            //alert.Accept();

                            break;
                        }
                    }
                    if (isFound)
                    {
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Esempio n. 2
0
        internal void EditShareSkill()
        {
            //Thread.Sleep(3000);
            GlobalDefinitions.Wait(3000);
            ManagementListingBtn.Click();
            //Thread.Sleep(2000);
            GlobalDefinitions.Wait(2000);
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "EditShareSkill");

            try
            {
                //Thread.Sleep(1000);
                GlobalDefinitions.Wait(1000);


                var table = _driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody")); //table

                var manageListRow = table.FindElements(By.TagName("tr")).ToList();                                                   //all rows picked


                var isFound = false;
                // var rows = _driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr"));  //each row and coloum


                for (int i = 1; i <= manageListRow.Count; i++)
                {
                    var row = _driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]")); //each row and coloum

                    var columnList = row.FindElements(By.TagName("td")).ToList();                                                                    //all coloum

                    for (int j = 1; j <= columnList.Count; j++)
                    {
                        var oldManageList = _driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[" + j + "]"));  //each row and coloum

                        //click on edit button with specific row and column

                        if (oldManageList.Text == "Code")
                        {
                            isFound = true;

                            _driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[8]/div/button[2]/i")).Click();   //edit button



                            break;
                        }
                    }
                    if (isFound)
                    {
                        break;
                    }
                }

                if (isFound)
                {
                    Thread.Sleep(1000);
                    //Add Title {edit value update from (Code)}
                    EditTitle.Clear();
                    EditTitle.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EditTitle"));
                    //Thread.Sleep(1000);
                    GlobalDefinitions.Wait(1000);


                    //Add Description
                    EditDescrp.Clear();
                    EditDescrp.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));
                    //Thread.Sleep(1000);
                    GlobalDefinitions.Wait(1000);


                    //Service type
                    OneOff.Click();
                    //Thread.Sleep(1000);
                    GlobalDefinitions.Wait(1000);


                    //Skill Trade
                    EditCredit.Click();
                    CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "CreditAmount"));
                    //Thread.Sleep(1000);
                    GlobalDefinitions.Wait(1000);


                    Save.Click();
                }
                else
                {
                    Console.WriteLine("Test Fail, Edit un-successful");
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }