FluentAutomation icon indicating copy to clipboard operation
FluentAutomation copied to clipboard

Custom JQuery/Sizzle Pseudo Selectors

Open rmbrntt opened this issue 10 years ago • 1 comments

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?

rmbrntt avatar Oct 08 '15 18:10 rmbrntt

Sorry I've been working on other things for awhile.. Interesting idea. Definitely something we can provide a hook for during bootstrapping I think.

stirno avatar Dec 29 '15 01:12 stirno