コード例 #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);
        }
コード例 #2
0
        public static IWebDriver GetDriver()
        {
            ChromeOptions options = new ChromeOptions();

            //options.AddArgument("--disable-extensions");
            options.AddArgument("start-maximized");
            options.AddArgument("disable-infobars");
            options.AddArgument("--blink-settings=imagesEnabled=false");


            IWebDriver driver = new ChromeDriver(options)
            {
                Url = "https://www.hotmail.com"
            };

            PageWaitTimings.WaitForPageLoad(driver);
            //PageWaitTimings.WaitForJQueryLoaded(driver);
            return(driver);
        }
コード例 #3
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);
            }
        }