コード例 #1
0
        // Detete a Property
        internal void DeleteProperty()
        {
            //Click on Owners tab
            Owners.Click();
            //Click Properties option
            Properties.Click();
            Thread.Sleep(1000);
            menulink.Click();
            Thread.Sleep(1000);
            //Click on Delete button
            Delete.Click();
            Thread.Sleep(1000);
            DeleteConfirmbtn.Click();
            string delhouse = Global.GlobalDefinition.driver.FindElement(By.XPath("//*[@id='main-content']/section/div[1]/div/div[3]/div/div[1]/div/div/div[2]/div[1]/div[1]/a/h3")).Text;

            if (File.Exists(delhouse))
            {
                Thread.Sleep(200);
                Global.Base.test.Log(LogStatus.Fail, "Test Failed, Record has not deleted");
            }
            else
            {
                Thread.Sleep(200);
                Global.Base.test.Log(LogStatus.Pass, "Test Passed, Record has been deleted successfully");
                Global.SaveScreenShotClass.SaveScreenshot(Global.GlobalDefinition.driver, "PropertyListDeleted");
            }
        }
コード例 #2
0
        public void DeleteManageListing()
        {
            //Populate the Excel Sheet
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "Manage Listings");
            Thread.Sleep(1000);

            //Click on Manage Listings tab
            ManageListingBtn.Click();
            Thread.Sleep(2000);

            IList <IWebElement> RowElements = RecordDetails.FindElements(By.TagName("tr"));

            Console.WriteLine(RowElements.Count);

            IList <IWebElement> removeBtn = GlobalDefinitions.driver.FindElements(By.XPath("//table/tbody/tr/td/i[3]"));
            int records      = RowElements.Count; // number of records in the table
            int deleteRecord = 0;

            //Delete a Record
            for (int i = 0; i <= RowElements.Count; i++)
            {
                IList <IWebElement> col = RowElements[i].FindElements(By.TagName("td"));
                Console.WriteLine(col.Count);

                if (col[2].Text == Global.GlobalDefinitions.ExcelLib.ReadData(2, "Delete record"))
                {
                    //RemoveIcon.Click();
                    Console.WriteLine(RowElements[i].Text);
                    removeBtn[i].Click();
                    Thread.Sleep(3000);
                    DeleteConfirmbtn.Click();
                    Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Service deleted");
                    records      = records - 1;
                    deleteRecord = i;
                    break;
                }
            }

            //Check Deleted Listing is still present in the Manage Listing
            if (records >= 1)
            {
                Console.WriteLine(deleteRecord);
                Console.WriteLine(RowElements[deleteRecord].Text);
                Thread.Sleep(2000);
                IList <IWebElement> col = RowElements[deleteRecord].FindElements(By.TagName("td"));
                if (col[2].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Delete record"))
                {
                    Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Deleted record still in the Manage Listings");
                }

                else
                {
                    Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Record Deleted from the manage Listing");
                }
            }
            //No more records in the Manage Listing
            else
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "You do not have any service listings!");
            }
        }