Example #1
0
        private static object ExecuteScript(string script, By locator, int index = 0)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, script, locator);

            return(((IJavaScriptExecutor)DriverSingleton.Driver).ExecuteScript(
                       script, DriverSingleton.Driver.FindElements(locator)[index]));
        }
Example #2
0
        public string GetCssValue(By locator, string propertyName)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, locator);

            Wait.StandardWait();

            return(DriverSingleton.Driver.FindElement(locator).GetCssValue(propertyName));
        }
Example #3
0
        public bool IsLinkActive(By locator)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, locator);

            Wait.StandardWait();

            return(DriverSingleton.Driver.FindElement(locator).GetCssValue("cursor").Equals("pointer"));
        }
Example #4
0
        public string GetValue(By locator)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, locator);

            Wait.StandardWait();

            return(JsExecutor.Value(locator));
        }
Example #5
0
        public string GetTextByJs(By locator)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, locator);

            Wait.StandardWait();

            return(JsExecutor.InnerText(locator));
        }
Example #6
0
        private static void ExecuteScript(string script, IWebElement element)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, script, element);

            ((IJavaScriptExecutor)DriverSingleton.Driver).ExecuteScript(script, element);

            LoggerSelenium.LogEnd(MethodBase.GetCurrentMethod().Name, script, element);
        }
Example #7
0
        public string GetAttribute(By locator, string attributeName, int index = 0)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, locator, attributeName, index);

            Wait.StandardWait();

            return(DriverSingleton.Driver.FindElements(locator)[index].GetAttribute(attributeName));
        }
Example #8
0
        public ReadOnlyCollection <IWebElement> FindElements(By locator)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, locator);

            Wait.StandardWait();

            return(DriverSingleton.Driver.FindElements(locator));
        }
Example #9
0
        public ReadOnlyCollection <IWebElement> FindElementsInReport(By locator)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, locator);

            Wait.StandardWait();
            Wait.ForRollerOnReportsToGoAway();

            return(this.FindElements(locator));
        }
Example #10
0
        public string GetText(By locator, int index = 0)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, locator);

            Wait.StandardWait();

            Wait.ForRollerOnReportsToGoAway();

            return(DriverSingleton.Driver.FindElements(locator)[index].Text);
        }
Example #11
0
        public bool IsElementPresent(By locator)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, locator);

            Wait.StandardWait();

            try
            {
                DriverSingleton.Driver.FindElement(locator);
                return(true);
            }
            catch (NoSuchElementException)
            {
                return(false);
            }
        }
Example #12
0
        public static string GetCurrentUrl()
        {
            LoggerSelenium.LogReturn(System.Reflection.MethodBase.GetCurrentMethod().Name);

            return(DriverSingleton.Driver.Url);
        }
Example #13
0
        public static string InnerText(By locator)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, locator);

            return((string)ExecuteScript("return arguments[0].innerText.trim()", locator));
        }
Example #14
0
        public static bool DocumentComplete()
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name);

            return(ExecuteScript("return document.readyState").Equals("complete"));
        }
Example #15
0
        public static bool Disabled(By locator, int index = 0)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, locator, index);

            return(ExecuteScript($"return arguments[0].disabled", locator, index).Equals(true));
        }
Example #16
0
        private static object ExecuteScript(string script)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, script);

            return(((IJavaScriptExecutor)DriverSingleton.Driver).ExecuteScript(script));
        }
Example #17
0
        public static string Value(By locator)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, locator);

            return((string)ExecuteScript("return arguments[0].value", locator));
        }
Example #18
0
        private static WebDriverWait SetWaitTime(int milliseconds)
        {
            LoggerSelenium.LogReturn(System.Reflection.MethodBase.GetCurrentMethod().Name, milliseconds);

            return(new WebDriverWait(DriverSingleton.Driver, TimeSpan.FromMilliseconds(milliseconds)));
        }
Example #19
0
        public bool DisabledByJs(By locator, int index = 0)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, locator, index);

            return(JsExecutor.Disabled(locator, index));
        }