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

            Wait.StandardWait();

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

            Wait.StandardWait();

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

            Wait.StandardWait();

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

            Wait.StandardWait();

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

            Wait.StandardWait();

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

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

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

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

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

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

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

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

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

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