コード例 #1
0
        private bool isPageLoaded(IWebDriver driver)
        {
            string script = "if(document.readyState == 'complete') return 'true';";

            //IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
            //string pageLoaded = js.ExecuteScript(script).ToString();
            JSExecuter = new CustomJavaScriptExecuter(driver);
            string pageLoaded = JSExecuter.Execute(script, new object[] { });

            //Retry again if problem exists
            if (pageLoaded == "" || pageLoaded == "customException")
            {
                System.Console.WriteLine("Script Tried Again in isPageLoaded");
                pageLoaded = JSExecuter.Execute(script, new object[] { });
            }

            if (pageLoaded == "true")
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
 public WaitFor(IWebDriver driver, By locator)
 {
     _driver    = driver;
     _locator   = locator;
     JSExecuter = new CustomJavaScriptExecuter(_driver);
 }