public void contactUrlChange() { string[] username = null; string[] password = null; var oXMLData = new XMLParse(); oXMLData.LoadXML("../../Config/ApplicationSettings.xml"); username = oXMLData.getData("settings/Credentials", "username_office"); password = oXMLData.getData("settings/Credentials", "password"); // Initializing the objects var executionLog = new ExecutionLog(); var loginHelper = new LoginHelper(GetWebDriver()); var contact_Helper = new Office_ContactsHelper(GetWebDriver()); // Variable var FirstName = "Test" + GetRandomNumber(); var LastName = "Tester" + GetRandomNumber(); var Number = "12345678" + GetRandomNumber(); String JIRA = ""; String Status = "Pass"; try { executionLog.Log("ContactUrlChange", "Login with valid username and password"); Login(username[0], password[0]); Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]); executionLog.Log("ContactUrlChange", "Verify Page title"); VerifyTitle("Dashboard"); Console.WriteLine("Redirected at Dashboard screen."); executionLog.Log("ContactUrlChange", "Goto User contacts"); VisitOffice("contacts"); executionLog.Log("ContactUrlChange", "Click On Any Contact"); contact_Helper.ClickElement("CheckTheFirstContact"); contact_Helper.WaitForWorkAround(2000); executionLog.Log("ContactUrlChange", "Change the url with the url number of another office"); VisitOffice("contacts/edit/97031"); contact_Helper.WaitForWorkAround(2000); executionLog.Log("ContactUrlChange", "Verify Validation"); contact_Helper.VerifyPageText("You don't have privileges to edit this Contact."); } catch (Exception e) { executionLog.Log("Error", e.StackTrace); Status = "Fail"; String counter = executionLog.readLastLine("counter"); String Description = executionLog.GetAllTextFile("ContactUrlChange"); String Error = executionLog.GetAllTextFile("Error"); if (counter == "") { counter = "0"; } bool result = loginHelper.CheckExstingIssue("Contact Url Change"); if (!result) { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); loginHelper.CreateIssue("Contact Url Change", "Bug", "Medium", "Contact page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error); string id = loginHelper.getIssueID("Contact Url Change"); TakeScreenshot("ContactUrlChange"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\ContactUrlChange.png"; loginHelper.AddAttachment(location, id); } } else { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); TakeScreenshot("ContactUrlChange"); string id = loginHelper.getIssueID("Contact Url Change"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\ContactUrlChange.png"; loginHelper.AddAttachment(location, id); loginHelper.AddComment(loginHelper.getIssueID("Contact Url Change"), "This issue is still occurring"); } } JIRA = loginHelper.getIssueID("Contact Url Change"); // executionLog.DeleteFile("Error"); throw; } finally { executionLog.DeleteFile("ContactUrlChange"); executionLog.WriteInExcel("Contact Url Change", Status, JIRA, "Office contacts"); } }