Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Existing jQuery overwritten #132

Open
predeekc opened this issue Oct 28, 2014 · 2 comments
Open

Existing jQuery overwritten #132

predeekc opened this issue Oct 28, 2014 · 2 comments
Assignees

Comments

@predeekc
Copy link

I'm testing an application that is running into problems when using the Selenium WebDriver. The specific problem is that once the JQuery script in FluentAutomation.Sizzle is loaded, window.jQuery and window.$ are no longer equivalent.

My solution was to update the Sizzle.Inject method to use the existing jQuery code if available and load the same as before if it's not. If this solution seems viable in other cases, I can submit a pull request.

public static void Inject(IJavaScriptExecutor executor)
{
    try
    {
        if ((bool)executor.ExecuteScript("return typeof fluentjQuery == 'undefined'"))
        {
            if ((bool)executor.ExecuteScript("return typeof window.jQuery == 'undefined'"))
            {
                executor.ExecuteScript(sizzleScriptInjection);
            }
            else
            {
                executor.ExecuteScript("window.fluentjQuery = window.jQuery");
            }                    
        }
    }
    catch { }
}
@jbblanchet
Copy link

👍

@stirno stirno self-assigned this Dec 29, 2015
scmccart added a commit to scmccart/FluentAutomation that referenced this issue Mar 15, 2016
stirno added a commit that referenced this issue Mar 16, 2016
@olidyu
Copy link

olidyu commented Mar 16, 2016

Added a comment about another way to fix it in #164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants