When I introduced the PatternMatcher stuff recently, I used the same kind of "reflection" trick we use for locators, commands, etc; PatternMatcher tried to map a prefix like "regexp" to a function-name like "RegexpMatchStrategy".

I realised tonight that it's simpler to just build the registry directly, rather than rely on these naming conventions. What it means is that rather than declaring

   PatternMatcher.RegexpMatchStrategy = function(pattern) ...

now it says

   PatternMatcher.strategies.regexp = function(pattern) ...

so we can index directly into the "strategies" array using the pattern prefix.

I wonder if we could use the same approach for locators and option-specifiers; what do you think? Perhaps even for commands and assertions, too??

I guess I'm talking about rethinking Selenium's extension API, and if we're rethinking it, we should probably be careful to introduce some consistency. Currently we have

   Selenium.prototype.doMyCommand = ...
   Selenium.prototype.assertMyCondition = ...
   PageBot.prototype.locateByMyCriteria = ...
   PatternMatcher.strategies.myPatternType = ...
   OptionLocatorFactory.prototype.OptionLocatorByMyCriteria = ...

How about something like:

   Selenium.commands.myCommand = ...
   Selenium.asserts.myCondition = ...
   Selenium.elementLocators.myCriteria = ...
   Selenium.patternMatchers.myPatternType = ...
   Selenium.optionMatchers.myCriteria = ...

Thoughts?

--
cheers, MikeW                            http://www.dogbiscuit.org/mdub/

_______________________________________________
Selenium-devel mailing list
[EMAIL PROTECTED]
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-devel

Reply via email to