コード例 #1
0
 internal void DeleteShareSkill()
 {
     try
     {
         //Click on Manage Listings
         ManageListings.Click();
         GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ManageListingExcelPath, "ManageListings");
         string FirstPath  = "//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[";
         string SecondPath = "]/td[3]";
         string getTitle   = null;
         bool   flag       = false;
         int    temp       = 0;
         while (true)
         {
             for (int rownum = 1; rownum <= (Totalrows.Count); rownum++)
             {
                 getTitle = GlobalDefinitions.driver.FindElement(By.XPath(FirstPath + rownum + SecondPath)).Text;
                 temp     = 1;
                 if (getTitle == GlobalDefinitions.ExcelLib.ReadData(2, "Title"))
                 {
                     if (GlobalDefinitions.ExcelLib.ReadData(2, "Deleteaction") == "Yes")
                     {
                         //Click on Delete
                         GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[" + rownum + "]/td[8]/div/button[3]/i")).Click();
                         GlobalDefinitions.wait(10000);
                         Yes.Click();
                         GlobalDefinitions.wait(10000);
                         Assert.Pass("Record is successfully deleted");
                         flag = true;
                         return;
                     }
                     else
                     {
                         //Click on Delete
                         GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[" + rownum + "]/td[8]/div/button[3]/i")).Click();
                         GlobalDefinitions.wait(10000);
                         No.Click();
                         GlobalDefinitions.wait(10000);
                         Assert.Pass("There is matching record but it is not deleted");
                         flag = true;
                         return;
                     }
                 }
             }
             if (flag == false)
             {
                 NextPage.Click();
             }
             if (temp == 1)
             {
                 Assert.Pass("There is no matching record to delete");
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);;
     }
 }
コード例 #2
0
 internal void EditShareSkill()
 {
     try
     {
         //Click on Manage Listings
         ManageListings.Click();
         //Populate the excel data
         GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
         string FirstPath  = "//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[";
         string SecondPath = "]/td[3]";
         string getTitle   = null;
         bool   flag       = false;
         int    temp       = 0;
         while (true)
         {
             for (int rownum = 1; rownum <= (Totalrows.Count); rownum++)
             {
                 getTitle = GlobalDefinitions.driver.FindElement(By.XPath(FirstPath + rownum + SecondPath)).Text;
                 temp     = 1;
                 if (getTitle == GlobalDefinitions.ExcelLib.ReadData(2, "Title"))
                 {
                     //Click on Edit button
                     GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[" + rownum + "]/td[8]/div/button[2]/i")).Click();
                     GlobalDefinitions.wait(7000);
                     //Clear the title and description
                     Title.Clear();
                     //Edit the title and Description
                     Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Edittitle"));
                     Description.Clear();
                     Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Editdescription"));
                     GlobalDefinitions.wait(6000);
                     Save.Click();
                     GlobalDefinitions.wait(7000);
                     flag = true;
                     Assert.Pass("Successfully Updated");
                     return;
                 }
             }
             if (flag == false)
             {
                 NextPage.Click();
             }
             if (temp == 1)
             {
                 Assert.Pass("There is no matching record to edit");
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }