Skip to content

Custom JQuery/Sizzle Pseudo Selectors #155

Description

@rmbrntt

Below is javascript for a custom pseudo selector which is being executed by IJavaScriptExecutor. This works well but I'm wondering if there is a way to globally apply custom JS functions to JQuery/Sizzle before a test is run so that in this example the selector ":icontains" doesn't need to be explicitly called.

        //case insensitive pseudo selector
        ((IJavaScriptExecutor)FluentTest.ProviderInstance).ExecuteScript(
            @"jQuery.expr[':'].icontains = function(a,i,m){
            return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0;};"
        );

        I.Find("span[class='select2-match']:icontains('ANYCase')");

Any thoughts on the best approach to make a custom JQuery function natively integrate into FluentAutomation's JQuery/Sizzle library?

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions