Feature and motivation
This is a continuation of #14530 point 1: "Discriminated unions". I proposed and implemented Local.Css nested type instead of CssLocator type. My last comment in that already resolved issue was:
I feel new CssLocator("div"); is better, we can make it before v5 if we have strong arguments (types discovery is a good argument).
I was wrong, and now I come with arguments. Actually only one argument. Nested type reserves its name in the parent. Which means we cannot add more members with the same name.
Use cases:
- Static factory: when Selenium Team will have capacity to add more useful methods like
Locator.Css("div") it will not be possible, because Css is already defined in Locator class.
- Static singleton: In
Script module we have LocalValue.Null class. This is great candidate to be singleton. But we cannot do it because Null name is already reserved by nested type.
Usage example
Before:
After:
And all types with similar pattern.
Feature and motivation
This is a continuation of #14530 point 1: "Discriminated unions". I proposed and implemented
Local.Cssnested type instead ofCssLocatortype. My last comment in that already resolved issue was:I was wrong, and now I come with arguments. Actually only one argument. Nested type reserves its name in the parent. Which means we cannot add more members with the same name.
Use cases:
Locator.Css("div")it will not be possible, becauseCssis already defined inLocatorclass.Scriptmodule we haveLocalValue.Nullclass. This is great candidate to be singleton. But we cannot do it becauseNullname is already reserved by nested type.Usage example
Before:
After:
And all types with similar pattern.