FluentAutomation
FluentAutomation copied to clipboard
Custom JQuery/Sizzle Pseudo Selectors
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?
Sorry I've been working on other things for awhile.. Interesting idea. Definitely something we can provide a hook for during bootstrapping I think.