Exemplo 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]));
        }
Exemplo 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));
        }
Exemplo 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"));
        }
Exemplo n.º 4
0
        public string GetValue(By locator)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, locator);

            Wait.StandardWait();

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

            Wait.StandardWait();

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

            Wait.StandardWait();

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

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

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

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

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

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

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

            return((string)ExecuteScript("return arguments[0].value", locator));
        }
Exemplo 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)));
        }
Exemplo n.º 19
0
        public bool DisabledByJs(By locator, int index = 0)
        {
            LoggerSelenium.LogReturn(MethodBase.GetCurrentMethod().Name, locator, index);

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