Ejemplo n.º 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]));
        }
Ejemplo n.º 2
0
        public string GetCssValue(By locator, string propertyName)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, locator);

            Wait.StandardWait();

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

            Wait.StandardWait();

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

            Wait.StandardWait();

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

            Wait.StandardWait();

            return(JsExecutor.InnerText(locator));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 8
0
        public ReadOnlyCollection <IWebElement> FindElements(By locator)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, locator);

            Wait.StandardWait();

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

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

            return(this.FindElements(locator));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 12
0
        public static string GetCurrentUrl()
        {
            LoggerSelenium.LogReturn(System.Reflection.MethodBase.GetCurrentMethod().Name);

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

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

            return(ExecuteScript("return document.readyState").Equals("complete"));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 16
0
        private static object ExecuteScript(string script)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, script);

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

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

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

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