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); } }
private string ExecuteThisScript(string script, object[] parameters) { return(JSExecuter.Execute(script, parameters)); }