/// <summary>
        /// Open Jounaler Documents
        /// </summary>
        /// <param name="reportType"></param>
        /// <param name="reportName"></param>
        public void ClickReportByTypeAndName(string reportType, string reportName)
        {
            CommonMethods.PlayWait(2000);
            DashboardPage dashboardPage = new DashboardPage(_driver);

            // Expand Left menu
            if (dashboardPage.IsMenuControlCollapsed())
            {
                dashboardPage.ExpandMenu();
            }
            CommonMethods.PlayWait(2000);

            _driver.ClickOnElement(ReportPageLocators.ReportsButton);
            CommonMethods.PlayWait(2000);
            _driver.ClickOnButton(reportType);
            CommonMethods.PlayWait(2000);
            var reportNameElement = _driver.FindElements(By.XPath(string.Format("//span[text()='{0}']", reportName)));

            if (reportNameElement.Any() && reportNameElement.FirstOrDefault().Displayed)
            {
                _driver.ClickOnButton(reportName);
            }
            else
            {
                //Open the reportname menu
                _driver.ClickOnButton(reportType);
                _driver.ClickOnButton(reportName);
            }
            CommonMethods.PlayWait(3000);
        }
Exemple #2
0
        /// <summary>
        /// Login to Application
        /// </summary>
        /// <param name="searchContent">Parameter of type Syste.String for searchContent</param>
        /// <param name="moduleName">Module Name to login</param>
        /// <returns>Parameter of type System.Boolean for True or False</returns>
        public void LogoutApplication()
        {
            try
            {
                DashboardPage dashboardPage = new DashboardPage(_driver);
                // Expand Left menu
                if (dashboardPage.IsMenuControlCollapsed())
                {
                    dashboardPage.ExpandMenu();
                }

                // Expand User Caret to click Logout
                SeleniumExtensions.ClickOnElement(_driver, LogoutPageElements.UserCaret);

                // Click Logout button
                _driver.WaitForElementVisible(LogoutPageElements.logout);
                _driver.ClickOnElement(LogoutPageElements.logout);

                //Clear browser cookies
                _driver.Manage().Cookies.DeleteAllCookies();
            }
            catch (Exception e)
            {
                CommonMethods.ThrowExceptionAndBreakTC("Unable to expand left menu in Dashboard \n" + e.GetType().FullName + "\n" + e.Message + "\n" + e.StackTrace);
            }
        }
        /// <summary>
        /// Click On Left Dashboard Menu Item
        /// </summary>
        /// <param name="menuItem"></param>
        public void ClickOnLeftDashboardMenuItem(string menuItem)
        {
            CommonMethods.PlayWait(2000);
            DashboardPage dashboardPage = new DashboardPage(_driver);

            // Expand Left menu
            if (dashboardPage.IsMenuControlCollapsed())
            {
                dashboardPage.ExpandMenu();
            }
            _driver.ClickOnElement(By.XPath(string.Format("//span[text()='{0}']", menuItem)));
        }