Beispiel #1
0
        public static void WaitAjax()
        {
            Contract.Assume(WebDriver != null);

            var ready = new Func <bool>(() => (bool)ExecuteJavaScript("return (typeof($) === 'undefined') ? true : !$.active;"));

            Contract.Assert(WaitHelper.SpinWait(ready, TimeSpan.FromSeconds(60), TimeSpan.FromMilliseconds(100)));
        }
Beispiel #2
0
        public static void WaitReadyState()
        {
            Contract.Assume(WebDriver != null);

            var ready = new Func <bool>(() => (bool)ExecuteJavaScript("return document.readyState == 'complete'"));

            Contract.Assert(WaitHelper.SpinWait(ready, TimeSpan.FromSeconds(60), TimeSpan.FromMilliseconds(100)));
        }
Beispiel #3
0
        private static ChromeDriver StartChrome()
        {
            var chromeOptions     = new ChromeOptions();
            var defaultDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\..\Local\Google\Chrome\User Data\Default";

            if (Directory.Exists(defaultDataFolder))
            {
                WaitHelper.Try(() => DirectoryHelper.ForceDelete(defaultDataFolder));
            }

            return(new ChromeDriver(Directory.GetCurrentDirectory(), chromeOptions));
        }
Beispiel #4
0
        public static void AcceptAlert()
        {
            var accept = WaitHelper.MakeTry(() => WebDriver.SwitchTo().Alert().Accept());

            WaitHelper.SpinWait(accept, TimeSpan.FromSeconds(5));
        }