Example #1
0
        public static void Refresh()
        {
            LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name);

            DriverSingleton.Driver.Navigate().Refresh();
            Wait.ForDocumentLoaded();

            LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name);
        }
Example #2
0
        public void ClearStorage()
        {
            LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name);

            JsExecutor.ClearSessionStorage();
            Wait.FromSeconds(1);

            LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name);
        }
Example #3
0
        public static void ForRollerOnReportsToGoAway()
        {
            LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name);

            ForDocumentLoaded();
            ForElementToLeave(ReportLocators.Spinner, DriverConsts.FourMinInMilliseconds);

            LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name);
        }
Example #4
0
        public static void ForRollersToGoAway()
        {
            LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name);

            ForDocumentLoaded();
            ForElementToLeave(By.CssSelector(@"div[class='lds-roller'] [style='display:block']"));

            LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name);
        }
Example #5
0
        public static void Clear(By locator)
        {
            LoggerSelenium.LogStart(MethodBase.GetCurrentMethod().Name, locator);

            Wait.StandardWait();
            DriverSingleton.Driver.FindElement(locator).Clear();

            LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name, locator);
        }
Example #6
0
        public void SendKeys(By locator, string value)
        {
            LoggerSelenium.LogStart(MethodBase.GetCurrentMethod().Name, locator, value);

            Wait.StandardWait();
            DriverSingleton.Driver.FindElement(locator).SendKeys(value);

            LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name, locator, value);
        }
Example #7
0
        public static void ClearCookiesAndCloseBrowser()
        {
            LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name);

            DriverSingleton.Driver.Manage().Cookies.DeleteAllCookies();
            DriverSingleton.Dispose();

            LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name);
        }
Example #8
0
        public void OpenMiDashboardPage()
        {
            LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name);

            Navigate.ToMiDashboard();
            this.miDashboardPage.WaitForMiDashboardLoaded();

            LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name);
        }
Example #9
0
        public void Click(By locator, int index = 0)
        {
            LoggerSelenium.LogStart(MethodBase.GetCurrentMethod().Name, locator);

            Wait.StandardWait();

            DriverSingleton.Driver.FindElements(locator)[index].Click();

            LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name, locator);
        }
Example #10
0
        public static void Until(Func <IWebDriver, IWebElement> condition)
        {
            LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name);

            WebDriverWait wait = new WebDriverWait(DriverSingleton.Driver, TimeSpan.FromSeconds(DriverConsts.Twenty));

            wait.Until(condition);

            LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name);
        }
Example #11
0
        public static void Until(Func <IWebDriver, bool> condition)
        {
            LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name);

            var wait = new WebDriverWait(DriverSingleton.Driver, new TimeSpan(0, 0, DriverConsts.Twenty));

            wait.Until(condition);

            LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name);
        }
Example #12
0
        public void MouseOverJs(IWebElement element)
        {
            LoggerSelenium.LogStart(MethodBase.GetCurrentMethod().Name, element);

            Wait.StandardWait();

            JsExecutor.MouseOver(element);

            LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name, element);
        }
Example #13
0
        public void ClickByJs(By locator, int index = 0, int scroll = -90)
        {
            LoggerSelenium.LogStart(MethodBase.GetCurrentMethod().Name, locator, index);

            JsExecutor.ScrollIntoView(locator);
            JsExecutor.ScrollBy(scroll);
            JsExecutor.Click(locator, index);

            LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name, locator, index);
        }
Example #14
0
        public void Click(IWebElement element)
        {
            LoggerSelenium.LogStart(MethodBase.GetCurrentMethod().Name);

            Wait.StandardWait();

            element.Click();

            LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name);
        }
Example #15
0
        public static void ForDocumentLoaded()
        {
            LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name);

            var wait = SetWaitTime(DriverConsts.ThreeMinInMilliseconds);

            wait.Until(d => JsExecutor.DocumentComplete());

            LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name);
        }
Example #16
0
        public void SendKeysByJs(By locator, string value)
        {
            LoggerSelenium.LogStart(MethodBase.GetCurrentMethod().Name, locator, value);

            Wait.StandardWait();

            JsExecutor.SendKeys(locator, value);
            JsExecutor.CallEventOnElement(locator);

            LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name, locator, value);
        }
Example #17
0
        public static void ForRollersOnWidgetsToGoAway()
        {
            LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name);

            ForDocumentLoaded();
            ForElementToLeave(
                By.CssSelector(@"div[class='spinner--overlay'] div[class='lds-roller']"),
                DriverConsts.ThreeMinInMilliseconds);

            LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name);
        }
Example #18
0
        public static void ForElement(By locator, int milliseconds = DriverConsts.TwoMinInMilliseconds)
        {
            LoggerSelenium.LogStart(System.Reflection.MethodBase.GetCurrentMethod().Name, locator, milliseconds);

            StandardWait();

            WebDriverWait wait = new WebDriverWait(
                DriverSingleton.Driver,
                TimeSpan.FromMilliseconds(milliseconds));

            wait.IgnoreExceptionTypes(typeof(NoSuchElementException));
            wait.Until(ExpectedConditions.ElementExists(locator));

            LoggerSelenium.LogEnd(System.Reflection.MethodBase.GetCurrentMethod().Name, locator, milliseconds);
        }
Example #19
0
        public static void MouseOver(IWebElement element)
        {
            LoggerSelenium.LogStart(MethodBase.GetCurrentMethod().Name, element);

            ExecuteScript(
                @"
                if (document.createEvent) {
                    var evObj = document.createEvent('MouseEvents');
                    evObj.initEvent('mouseover', true, false);
                    arguments[0].dispatchEvent(evObj);
                } else if (document.createEventObject) {
                    arguments[0].fireEvent('onmouseover');
                }",
                element);

            LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name, element);
        }
Example #20
0
        public static void CallEventOnElement(By locator)
        {
            LoggerSelenium.LogStart(MethodBase.GetCurrentMethod().Name, locator);

            // ExecuteScript($@"arguments[0].dispatchEvent(new Event('input')", locator);
            // ExecuteScript($@"arguments[0].dispatchEvent(new Event('change')", locator);
            ExecuteScript(
                @"
                var createEvent = function ieEventPolyfill(eventName) {
                    var event = document.createEvent('Event');
                    event.initEvent(eventName, true, true);
                    return event;
                }
                arguments[0].dispatchEvent(createEvent('keyup'));
                arguments[0].dispatchEvent(createEvent('input'));",
                locator);

            LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name, locator);
        }