private async void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (webDriver != null) { await webDriver.Close(); } }
//Purpose: to click Add Button public void ClickAddButton() { try { GenericHelper.WaitUntilElement(By.ClassName("btn_add")); bool isButtonAddEnabled = WebDriver.FindElement(By.ClassName("btn_add")).Enabled; if (isButtonAddEnabled) { GenericHelper.Logs("'Button Add' get enabled after selecting the course in left frame.", "PASSED"); WebDriver.FindElement(By.ClassName("btn_add")).Click(); } else { GenericHelper.Logs("'Button Add' not enabled after selecting the course in left frame.", "FAILED"); throw new Exception("'Button Add' not enabled after selecting the course in left frame."); } } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); if (GenericHelper.IsPopUpWindowPresent("Content")) { GenericHelper.SelectWindow("Content"); WebDriver.Close(); } throw new Exception(e.ToString()); } }
public void verifyBulkRegistration() { try { GenericHelper.SelectWindow("Manage Organization"); WebDriver.SwitchTo().Frame("frm"); if (GenericHelper.IsElementPresent(By.Id("lblQueueInfo")) && GenericHelper.IsElementPresent(By.Id("lnkViewQueueData"))) { GenericHelper.Logs("After uploading bulk students 'Bulk Registration- 1 of 1 Files in progress View Registration Queue' Text Displayed", "PASSED"); } else { GenericHelper.Logs("After uploading bulk students 'Bulk Registration- 1 of 1 Files in progress View Registration Queue' Text not Displayed", "FAILED"); } } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); if (GenericHelper.IsPopUpWindowPresent("Manage Organization")) { GenericHelper.SelectWindow("Manage Organization"); WebDriver.Close(); } throw new Exception(e.ToString()); } }
//To search for assigned template in HED program admin public void ToSearchForAssignedHedProgramAdmin() { try { GenericHelper.ToVerifyTemplateInactiveState(); GenericHelper.WaitUntilElement(By.XPath("//div[@id='grdTemplateSection$divContent']/table/tbody/tr/td/table/tbody/tr/td[2]")); IWebElement redTextPresent = WebDriver.FindElement(By.XPath("//div[@id='grdTemplateSection$divContent']/table/tbody/tr/td/table/tbody/tr/td[2]")); if (redTextPresent.Text.Contains("[Request is Processing")) { GenericHelper.Logs(string.Format("[Request is Processing] state has not validated for copying template."), "FAILED"); WebDriver.Close(); Assert.Fail(string.Format("[Request is Processing state has not validated for copying template.")); } else { GenericHelper.WaitUntilElement(By.XPath("//div[@id='grdTemplateSection$divContent']/descendant::th[@class='thCourseInQ']/span")); IWebElement templateClick = WebDriver.FindElement(By.XPath("//div[@id='grdTemplateSection$divContent']/descendant::th[@class='thCourseInQ']/span")); templateClick.Click(); GenericHelper.WaitUtilWindow("Calendar"); } } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); Assert.Fail(e.ToString()); } }
//Purpose - Move the ML to the right frame public void MoveToRightFrame() { try { GenericHelper.SelectWindow("Content"); WebDriver.SwitchTo().Frame("ifrmLeft"); WebDriver.SwitchTo().ActiveElement(); GenericHelper.WaitUntilElement(By.XPath("//table[@id='grdCourseContent']/tbody/tr[2]//INPUT[@id='grdCourseContent$_ctrl1']")); WebDriver.FindElement(By.XPath("//table[@id='grdCourseContent']/tbody/tr[2]//INPUT[@id='grdCourseContent$_ctrl1']")).Click(); GenericHelper.Logs("Master Library has been successfully selected under the content frame.", "passed"); WebDriver.SwitchTo().DefaultContent(); } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); if (GenericHelper.IsPopUpWindowPresent("Content")) { GenericHelper.SelectWindow("Content"); WebDriver.Close(); } if (GenericHelper.IsPopUpWindowPresent("Overview")) { GenericHelper.SelectWindow("Overview"); WebDriver.Close(); } throw new Exception(e.ToString()); } }
private async void Button_Click_13(object sender, RoutedEventArgs e) { try { var asyncChromeDriver = new AsyncChromeDriver(new ChromeDriverConfig().SetHeadless()); var webDriver = new WebDriver(asyncChromeDriver); await webDriver.GoToUrl("https://www.google.com/"); await Task.Delay(500); var screenshot = await webDriver.GetScreenshot(); //screenshot.SaveAsFile(GetFilePathToSaveScreenshot(), Zu.WebBrowser.BasicTypes.ScreenshotImageFormat.Png); using (MemoryStream imageStream = new MemoryStream(screenshot.AsByteArray)) { System.Drawing.Image screenshotImage = System.Drawing.Image.FromStream(imageStream); screenshotImage.Save(GetFilePathToSaveScreenshot(), System.Drawing.Imaging.ImageFormat.Png); } await webDriver.Close(); } catch (Exception ex) { tbDevToolsRes.Text = ex.ToString(); tbDevToolsRes2.Text = ex.ToString(); } }
//Purpose : to click 'Enroll in Selected' button in Enrollment tab of Manage Organization Page public void ClickEnrollButton() { try { GenericHelper.SelectWindow("Manage Organization"); WebDriver.SwitchTo().Frame("frm"); WebDriver.SwitchTo().Frame("ifrmMiddle"); if (WebDriver.FindElement(By.Id("btnEnroll")).Enabled) { try { GenericHelper.WaitUntilElement(By.Id("btnEnroll")); WebDriver.FindElement(By.Id("btnEnroll")).Click(); GenericHelper.Logs("Enroll button get enabled on selecting the user in enrollment tab under user frame", "PASSED"); } catch (Exception e) { GenericHelper.Logs("Enroll button not get enabled on selecting the user in enrollment tab under user frame.", "FAILED"); throw new Exception(e.ToString()); } } } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); if (GenericHelper.IsPopUpWindowPresent("Manage Organization")) { GenericHelper.SelectWindow("Manage Organization"); WebDriver.Close(); } throw new Exception(e.ToString()); } }
public void ThenItShouldDisplaySuccessfulMessageInPage(string successMsg, string page) { try { GenericHelper.SelectWindow(page); bool ismessagedisplayed = GenericHelper.VerifySuccesfullMessage(successMsg); if (ismessagedisplayed) { GenericHelper.Logs(successMsg + " : successful message displayed.", "PASSED"); } else { GenericHelper.Logs(successMsg + " : successful message not displayed.", "FAILED"); Assert.Fail(successMsg + ": successful message not displayed."); } } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); bool isManageOrganizationWindowPresent = GenericHelper.IsPopUpWindowPresent("Manage Organization"); if (isManageOrganizationWindowPresent) { GenericHelper.SelectWindow("Manage Organization"); WebDriver.Close(); } ThenIClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication(); throw new Exception(e.ToString()); } }
public static void WhenIClosetheManageOrganizationAndLogOutFromTheApplication() { try { WebDriver.Close(); GenericHelper.SelectWindow("Organization Management"); WebDriver.FindElement(By.LinkText("Sign out")).Click(); WebDriver.Manage().Cookies.DeleteAllCookies(); Thread.Sleep(3000); bool logout = WebDriver.Url.Contains("logout"); if (logout) { GenericHelper.Logs("logout successful", "PASSED"); } else { GenericHelper.Logs("logout failed", "FAILED"); } } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); throw new Exception(e.ToString()); } }
public void GoToManageOrganizationPage() { try { if (!GenericHelper.IsPopUpWindowPresent("Manage Organization")) { GenericHelper.SelectDefaultWindow(); GenericHelper.WaitUntilElement(By.Id("_ctl8__ctl11_Link")); IWebElement orgAdminLink = WebDriver.FindElement(By.Id("_ctl8__ctl11_Link")); orgAdminLink.Click(); string schoolName = DatabaseTools.GetOrganization(Enumerations.OrgLevelType.School); SearchAndSelectOrg(schoolName); } GenericHelper.SelectWindow("Manage Organization"); } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); bool isWindowPresentManageOrganization = GenericHelper.IsPopUpWindowPresent("Manage Organization"); if (isWindowPresentManageOrganization) { GenericHelper.SelectWindow("Manage Organization"); WebDriver.Close(); } throw new Exception(e.ToString()); } }
// Purpose : to close the Detailed Student Activity Report page public void CloseWindow() { try { GenericHelper.WaitUntilElement(By.ClassName("btn_syn_s")); WebDriver.FindElement(By.ClassName("btn_syn_s")).Click(); bool isDetailedStudentActivityReportClosed = GenericHelper.IsPopUpClosed(3); if (isDetailedStudentActivityReportClosed) { GenericHelper.Logs("'Detailed Student Activity Report' pop-up closed successfully.", "PASSED"); } else { GenericHelper.Logs("'Detailed Student Activity Report' pop-up not closed successfully.", "FAILED"); throw new Exception("'Detailed Student Activity Report' pop-up not closed successfully."); } } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); bool isDetailedStudentActivityReportWindowOpened = GenericHelper.IsPopUpWindowPresent("Detailed Student Activity Report"); if (isDetailedStudentActivityReportWindowOpened) { GenericHelper.SelectWindow("Detailed Student Activity Report"); WebDriver.Close(); } throw new Exception(e.ToString()); } }
//Purpose: Method to Select Licenses Tab public void CreateLicenses(string productInstance) { try { GenericHelper.SelectWindow("Manage Organization"); WebDriver.FindElement(By.Id("frm")); WebDriver.SwitchTo().Frame("frm"); GenericHelper.WaitUntilElement(By.Id("lblAddproducts")); WebDriver.FindElement(By.Id("lblAddproducts")).Click(); switch (productInstance) { case "NovaNET": new ProductDefaultPage().SelectProduct(Enumerations.ProductInstance.NovaNET); break; case "DigitalPath": new ProductDefaultPage().SelectProduct(Enumerations.ProductInstance.DigitalPath); break; } } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); if (GenericHelper.IsPopUpWindowPresent("Manage Organization")) { GenericHelper.SelectWindow("Manage Organization"); WebDriver.Close(); } throw new Exception(e.ToString()); } }
public void CleanUp() { //Closing the browser and reporter. WebDriver.Close(); Reporter.LogInfo("Closed the browser !!!"); Reporter.EndReport(); }
//Purpose: To select the class with ClassType public void SelectClassWithClassType(string classType) { try { switch (classType) { case "Template": SelectClass(Enumerations.ClassType.NovaNETTemplate); break; case "Master Library": SelectClass(Enumerations.ClassType.NovaNETMasterLibrary); break; case "Placeholder": SelectClass(Enumerations.ClassType.NovaNETPlaceHolder); break; } } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); if (GenericHelper.IsPopUpWindowPresent("Manage Organization")) { GenericHelper.SelectWindow("Manage Organization"); WebDriver.Close(); } throw new Exception(e.ToString()); } }
public void WhenICreatedTheUserAsStudent(Table table) { try { bool isWindowPresent = GenericHelper.IsPopUpWindowPresent("Manage Organization"); if (isWindowPresent) { GenericHelper.SelectWindow("Manage Organization"); WebDriver.SwitchTo().DefaultContent(); } else { // WebDriver.Close(); string schoolName = DatabaseTools.GetOrganization(Enumerations.OrgLevelType.School); _organizationManagement.SearchAndSelectOrg(schoolName); } // Purpose: To Create Users _manageUserPage.Createusers(table); } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); if (GenericHelper.IsPopUpWindowPresent("Manage Organization")) { GenericHelper.SelectWindow("Manage Organization"); WebDriver.Close(); } GenericDefinitions.ThenIClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication(); throw new Exception(e.ToString()); } }
//Purpose : To add cs user public void AddUser(Table table, string username) { try { GenericHelper.WaitUntillWindowAndElement("Add User", By.Id("txtLoginName")); ((string[])(table.Rows[0].Values))[1] = username; ((string[])(table.Rows[1].Values))[1] = "bdd_pwd123"; ((string[])(table.Rows[2].Values))[1] = username; ((string[])(table.Rows[3].Values))[1] = username; ((string[])(table.Rows[4].Values))[1] = "*****@*****.**"; foreach (var tableRow in table.Rows) { GenericHelper.WaitUntilElement(By.Id(tableRow["Field"])); WebDriver.FindElement(By.Id(tableRow["Field"])).SendKeys(tableRow["Value"]); } WebDriver.FindElement(By.Id("imgBtnSave")).Click(); GenericHelper.IsPopUpClosed(3); } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); if (GenericHelper.IsPopUpWindowPresent("Add User")) { GenericHelper.SelectWindow("Add User"); WebDriver.Close(); } throw new Exception(e.ToString()); } }
//Purpose: Method to Select Licenses Tab public void ToSelectAddTemplate() { try { GenericHelper.SelectWindow("Manage Organization"); WebDriver.SwitchTo().Frame("frm"); GenericHelper.WaitUntilElement(By.XPath("//IMG[@class='tdAddImg']")); WebDriver.FindElement(By.XPath("//IMG[@class='tdAddImg']")).Click(); WebDriver.FindElement(By.XPath("//TR[@id='trTemplate']")).Click(); WebDriver.SwitchTo().ActiveElement(); bool isAddTemplateWindowOpened = GenericHelper.WaitUtilWindow("Add Template"); if (isAddTemplateWindowOpened) { //Purpose: Calling Method To Create Template new AddTemplatePage().ToCreateTemplate(); } else { GenericHelper.Logs("'Add Template' pop-up not opened for template creation.", "FAILED"); Assert.Fail("'Add Template' pop-up not opened for template creation."); } } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); if (GenericHelper.IsPopUpWindowPresent("Manage Organization")) { GenericHelper.SelectWindow("Manage Organization"); WebDriver.Close(); } throw new Exception(e.ToString()); } }
// Purpose: To Verify Activity Preference Retained public void ToVerifyFeedbackPreference() { WebDriver.SwitchTo().DefaultContent(); GenericHelper.SelectWindow("Preferences"); WebDriver.SwitchTo().ActiveElement(); GenericHelper.WaitUntilElement(By.Id("_ctl0__ctl0_phBody_PageContent_ifrmPreferences")); WebDriver.SwitchTo().Frame("_ctl0__ctl0_phBody_PageContent_ifrmPreferences"); GenericHelper.WaitUntilElement(By.XPath("//table[@id='tblActivities']/tbody/tr[3]/td[7]/a")); WebDriver.FindElement((By.XPath("//table[@id='tblActivities']/tbody/tr[3]/td[7]/a"))).Click(); GenericHelper.SelectWindow("Default preferences"); Assert.AreEqual("Default preferences", WebDriver.Title); GenericHelper.WaitUntilElement(By.PartialLinkText("Feedback")); WebDriver.FindElement(By.PartialLinkText("Feedback")).Click(); GenericHelper.WaitUntilElement(By.Id("rdCorrectAnsAlways")); if (WebDriver.FindElement(By.Id("rdCorrectAnsAlways")).Selected) { GenericHelper.Logs("The radio button for option 'Display correct answers after student submits activity' selected under Feedback preference for a particular activity type has retained in Master course. ", "Passed"); } else { GenericHelper.Logs("The radio button for option 'Display correct answers after student submits activity' selected under Feedback preference for a particular activity type has not retained in Master course.", "Failed"); Assert.Fail("The radio button for option 'Display correct answers after student submits activity' selected under Feedback preference for a particular activity type has not retained in Master course."); } WebDriver.Close(); GenericHelper.SelectWindow("Preferences"); }
public void CreateClassUsingTemplateOption() { try { GenericHelper.SelectWindow("Create Class"); bool isCreateClassWindowOpened = GenericHelper.WaitUtilWindow("Create Class"); if (isCreateClassWindowOpened) { _objClassCreation.ToCreateClass(); } else { GenericHelper.Logs("'Create Class' pop-up not opened for creation of class using template.", "FAILED"); throw new NoSuchWindowException("'Create Class' pop-up not opened for creation of class using template."); } GenericHelper.SelectWindow("Manage Organization"); } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); if (GenericHelper.IsPopUpWindowPresent("Manage Organization")) { GenericHelper.SelectWindow("Manage Organization"); WebDriver.Close(); } GenericDefinitions.ThenIClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication(); throw new Exception(e.ToString()); } }
//Purpose: To Create Course using ML public void CreateCourseUsingML() { try { GenericHelper.SelectWindow("Create Course"); bool isNoCousefoundPresent = GenericHelper.IsElementPresent(By.Id("_ctl0_lblNoCousefound")); if (isNoCousefoundPresent) { GenericHelper.Logs("There are no items present to create course.", "FAILED"); throw new NoSuchElementException("There are no items present to create course."); } else { GenericHelper.Logs("Course has been present to create course by CS Teacher.", "PASSED"); } int producttablecount = WebDriver.FindElements(By.Id("tblCourseList")).Count; string productname = null; for (int i = 1; i <= producttablecount; i++) { if (Browser.Equals("IE")) { productname = WebDriver.FindElement(By.XPath(div_productType + "/TABLE[" + producttablecount.ToString(CultureInfo.InvariantCulture) + "]")).GetAttribute("innerText"); } if (Browser.Equals("FF") || Browser.Equals("GC")) { productname = WebDriver.FindElement(By.XPath(div_productType + "/TABLE[" + producttablecount.ToString(CultureInfo.InvariantCulture) + "]")).Text; } string getProductName = DatabaseTools.GetProduct(Enumerations.ProductInstance.NovaNET); if (productname != null && getProductName.Contains(getProductName)) { int courseCount = WebDriver.FindElements(By.XPath(div_productType + "/TABLE[" + producttablecount.ToString(CultureInfo.InvariantCulture) + "]/tbody/tr[2]/td/table/tbody/tr/td/div" + Table_CourseList)).Count; WebDriver.FindElement(By.XPath(CheckboxCourse(i.ToString(CultureInfo.InvariantCulture), courseCount.ToString(CultureInfo.InvariantCulture)))).Click(); GenericHelper.WaitUntilElement(By.Id("btnFinish")); WebDriver.FindElement(By.Id("btnFinish")).Click(); bool isCreateCoursePopUpClosed = GenericHelper.IsPopUpClosed(2); if (isCreateCoursePopUpClosed) { GenericHelper.Logs("'Create Course' pop-up window closed successfuly.", "PASSED"); } else { GenericHelper.Logs("'Create Course' pop-up window not closed successfuly.", "FAILED"); throw new SystemException("'Create Course' pop-up window not closed successfuly."); } break; } else if (i == producttablecount) { GenericHelper.Logs("Create course pop up does not contains required product and course hence unable to select the course.", "FAILED"); } } } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); WebDriver.Close(); throw new Exception(e.ToString()); } }
public static void CleanUp() { WebDriver.Close(); _homePage = null; _loginPage = null; _myAccountPage = null; _driver = null; }
public virtual void Dispose() { if (WebDriver != null) { WebDriver.Close(); WebDriver.Quit(); } }
private async void Button_Click_1(object sender, RoutedEventArgs e) { await webDriver?.Close(); //await asyncChromeDriver?.Close(); tbDevToolsRes.Text = "closed"; tbDevToolsRes2.Text = "closed"; }
private async void OpenTab_Button_Click_3(object sender, RoutedEventArgs e) { if (webDriver != null) { await webDriver.Close(); } tbDevToolsRes2.Text = "closed"; }
public void OneTimeTearDown() { Task.WaitAll( Task.Run(() => WebDriver.Close()), Task.Run(() => WebServer.AfterTests())); Styler.Set(new EmptyStyle()); }
// Purpose: Create a Class Using ML public void ToCreateClassUsingML() { try { int rowNo = 1; WebDriver.WindowHandles.Any(item => WebDriver.SwitchTo().Window(item).Title == "Create Class"); WebDriver.SwitchTo().Frame("iframeCreateClass"); Classname = GenericHelper.GenerateUniqueVariable("ClassML"); DatabaseTools.UpdateClass(Enumerations.ClassType.NovaNETMasterLibrary, Classname); WebDriver.FindElement(By.Id("clsClassInformation_txtNewClassName")).SendKeys(Classname); WebDriver.SwitchTo().DefaultContent(); GenericHelper.WaitUntilElement(By.Id("btnNext")); WebDriver.FindElement(By.Id("btnNext")).Click(); WebDriver.SwitchTo().Frame("iframeCreateClass"); GenericHelper.WaitUntilElement(By.Id("clsClassInformation_rdbChooseProduct")); WebDriver.FindElement(By.Id("clsClassInformation_rdbChooseProduct")).Click(); WebDriver.SwitchTo().DefaultContent(); WebDriver.FindElement(By.Id("btnNext")).Click(); Thread.Sleep(2000); WebDriver.SwitchTo().Frame("iframeCreateClass"); string className = WebDriver.FindElement(By.XPath("//table[@id='tblCourseList']/tbody/tr[" + rowNo + "]")).Text.Trim(); string dbmlName = DatabaseTools.GetCourse(Enumerations.CourseType.MasterLibrary).Trim(); if (className == dbmlName) { WebDriver.FindElement(By.XPath("//table[@id='tblCourseList']/tbody/tr[" + rowNo + "]/td/input[@id='selectcheckbox']")).Click(); } while (className != dbmlName) { rowNo = rowNo + 1; className = WebDriver.FindElement(By.XPath("//table[@id='tblCourseList']/tbody/tr[" + rowNo + "]")).Text.Trim(); if (className == dbmlName) { WebDriver.FindElement(By.XPath("//table[@id='tblCourseList']/tbody/tr[" + rowNo + "]/td/input[@id='selectcheckbox']")).Click(); } } WebDriver.SwitchTo().DefaultContent(); WebDriver.FindElement(By.Id("btnNext")).Click(); GenericHelper.WaitUntilElement(By.Id("btnNext")); WebDriver.FindElement(By.Id("btnNext")).Click(); GenericHelper.WaitUntilElement(By.Id("btnFinish")); WebDriver.FindElement(By.Id("btnFinish")).Click(); GenericHelper.IsPopUpClosed(3); ToSearchForAssigned((Enumerations.ClassType.NovaNETMasterLibrary)); WebDriver.Close(); GenericHelper.IsPopUpClosed(2); } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); bool isCreateClassWindowPresent = GenericHelper.IsPopUpWindowPresent("Create Class"); if (isCreateClassWindowPresent) { GenericHelper.SelectWindow("Create Class"); WebDriver.Close(); } throw new Exception(e.ToString()); } }
public void CloseBrowser() { if (_webDriver == null) { return; } _webDriver.Close(); _webDriver = null; }
//Purpose : to verify the activity submission public void ToVerifyActivitySubmission() { try { //Purpose: Wait for Activity Presentation page gets loded bool waitForThinkingIndicatorClose = GenericHelper.ThinkingIndicatorProcessing(); if (waitForThinkingIndicatorClose) { GenericHelper.Logs("Activity Submission page has been successfully loaded.", "PASSED"); } else { GenericHelper.Logs("Activity Submission page has not been successfully loaded under ideal time interval.", "FAILED"); Assert.Fail("Activity Submission page has not been successfully loaded under ideal time interval."); } WebDriver.SwitchTo().DefaultContent(); if (GenericHelper.IsElementPresent((By.PartialLinkText("Return to Course")))) { GenericHelper.Logs("Activity submitted by the student successfully.", "PASSED"); GenericHelper.WaitUntilElement(By.PartialLinkText("Return to Course")); WebDriver.FindElement(By.PartialLinkText("Return to Course")).Click(); GenericHelper.SelectWindow("Quiz"); GenericHelper.WaitUntilElement(By.Id("btnClose")); IWebElement clickClose = WebDriver.FindElement(By.Id("btnClose")); clickClose.Click(); Thread.Sleep(3000); } else { GenericHelper.Logs("Activity not submitted by student successfully.", "FAILED"); } if (GenericHelper.IsPopUpClosed(2)) { GenericHelper.Logs("Presentation window closed on clicking 'Return to Course'", "PASSED"); } else { GenericHelper.Logs("Presentation window not closed on clicking 'Return to Course'", "FAILED"); WebDriver.Close(); Assert.Fail("Presentation window not closed on clicking 'Return to Course'"); } GenericHelper.SelectDefaultWindow(); } catch (Exception e) { GenericHelper.Logs(e.ToString(), "FAILED"); if (GenericHelper.IsPopUpWindowPresent("Quiz")) { GenericHelper.SelectWindow("Quiz"); WebDriver.Close(); } throw new Exception(e.ToString()); } }
public void OneTimeTearDown() { if (FailedTests == 0 && SucceededTests > 0) { if (WebDriver != null) { WebDriver.Close(); } } }
public void Dispose() { if (!disposedValue) { WebDriver?.Close(); WebDriver?.Dispose(); disposedValue = true; } GC.SuppressFinalize(this); }