Posts

Showing posts with the label JQuery

C# Selenium code to inject JQuery into wepage

 Below is the sample JQueryUtility class in C# selenium code to verify if jQuery is available on the webpage .If it is not available then inject jQuery into the webpage.      class jQueryUtility     {         private void InjectJqueryIfNeeded()         {             if (!jQueryLoaded())                 InjectJquery();         } //Verify if Jquery is loaded or not.         public Boolean jQueryLoaded()         {             Boolean loaded = false;             IJavaScriptExecutor js = WebDriver as IJavaScriptExecutor;             loaded = (bool)js.ExecuteScript("return window.jQuery ");             return loaded;         } //Inject J...