public void DeleteListing(IWebDriver Driver) { //Click Manage Listings Menu ManageListingsMenu.Click(); Thread.Sleep(5000); IJavaScriptExecutor javascript = (IJavaScriptExecutor)Driver; javascript.ExecuteScript("arguments[0].click();", ManageListTitle); try { Assert.IsTrue(ManageListTitle.Displayed); //Click Delete Icon javascript.ExecuteScript("arguments[0].click();", Delelement); //click "Yes" in delete pop up DelYes.Click(); } catch (Exception e) { Console.WriteLine(e); } //Verfication string ExpResult3 = "Software Tester 7 has been deleted"; Thread.Sleep(2000); string ActualResult3 = ActResult3.Text; if (ExpResult3 == ActualResult3) { Console.WriteLine("Test 3 Pass : Record deleted successfully"); // Helpers.SaveScreenShotClass.SaveScreenshot(CommonDriver.Driver, "Delete Listing"); } else { Console.WriteLine("Test 3 Fail: Record not deleted"); } // try // { // Assert.AreEqual("Software tester 7 has been deleted",ActResult3.Text); // Console.WriteLine("Test Fail: Skill listing still present"); // } // catch(Exception e) // { // Console.WriteLine("Test Pass: Skill listing Deleted"); // } // } //} }
//Delete Method public void DeleteListing(IWebDriver Driver) { //Click Manage Listings Menu ManageListingsMenu.Click(); Thread.Sleep(5000); //Identify Title of the record to be deleted IJavaScriptExecutor js3 = (IJavaScriptExecutor)Driver; js3.ExecuteScript("arguments[0].click();", ManageListTitle); //Click Delete icon IJavaScriptExecutor js2 = (IJavaScriptExecutor)Driver; js2.ExecuteScript("arguments[0].click();", Delelement); //click "Yes" in delete pop up DelYes.Click(); //Verfication try { Thread.Sleep(5000); Assert.IsTrue(ActResult3.Displayed); Console.WriteLine("Test 3 Pass : Record deleted successfully"); // Screenshot String img = Global.GlobalDefinitions.SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.Driver, "Report");//AddScreenCapture(@"E:\Dropbox\VisualStudio\Projects\Beehive\TestReports\ScreenShots\"); Base.test.Log(LogStatus.Info, "Image example: " + img); // end test. (Reports) Base.extent.EndTest(Base.test); // calling Flush writes everything to the log file (Reports) Base.extent.Flush(); } catch (Exception e) { Console.WriteLine(e); Console.WriteLine("Test 3 Pass : Record NOT deleted"); } }