Esempio n. 1
0
        public static void ClickButton(IWebDriver driver, string jQueryObject, int indexValue)
        {
            PageWaitTimings.WaitForJQueryLoaded(driver);
            PageWaitTimings.WaitForElementVisible(driver, jQueryObject);
            string script = "$(" + jQueryObject + ")[" + indexValue + "].click()";

            Console.WriteLine(script);
            ((IJavaScriptExecutor)driver).ExecuteScript(script);
        }
Esempio n. 2
0
        public static void ClickButton(IWebDriver driver, string jQueryObject)
        {
            PageWaitTimings.WaitForJQueryLoaded(driver);
            PageWaitTimings.WaitForElementVisible(driver, jQueryObject);
            string script = string.Empty;

            if (!jQueryObject.StartsWith("$"))
            {
                script = "$(" + jQueryObject + ").click()";
                Console.WriteLine(script);
                ((IJavaScriptExecutor)driver).ExecuteScript(script);
            }
            else
            {
                script = jQueryObject + ".click()";
                Console.WriteLine(script);
                ((IJavaScriptExecutor)driver).ExecuteScript(script);
            }
        }