selenium-google-code-issue-archive icon indicating copy to clipboard operation
selenium-google-code-issue-archive copied to clipboard

Request: Remove sealed from FindsByAttribute

Open lukeis opened this issue 8 years ago • 2 comments

Originally reported on Google Code with ID 7707

I know this has been discussed before: https://code.google.com/p/selenium/issues/detail?id=4878

But I'd like to request it again.  Here is why:

1)  It appears that FindsByAttribute is sealed due to the general recommendation of
Microsoft: http://msdn.microsoft.com/en-us/library/ms182267.aspx

2)  But Microsoft only recommends "avoiding" sealing attributes; it's a suggestion,
not an ironclad rule.  (see above link)

3)  Microsoft also recommends "Do not seal classes without having a good reason to
do so."  Is the aforementioned "avoid" a good reason?  http://msdn.microsoft.com/en-us/library/ms229023(v=vs.110).aspx

4)  Microsoft also says "Sealed attributes have slightly higher performance levels
than unsealed ones."  Are the performance gains great enough to justify the hassle
in not being able to override FindsByAttribute?


I'll grant, it's no showstopper.  I simply want to inherit from FindsByAttribute so
I can replace this...

  [FindsBy(How = How.CssSelector, Using = "#search")]
  IWebElement SearchBox { get; set; }

...with something like this...

  [Css("#search")]
  IWebElement SearchBox { get; set; }

Multiplied over many lines of code, I'd rather have the readability gain than the theoretical
performance gain of the sealed attribute.

Have any performance tests demonstrated that sealing the class makes Selenium significantly
faster?

Reported by rlundy on 2014-08-04 19:40:51

lukeis avatar Mar 04 '16 08:03 lukeis

Reported by barancev on 2014-08-05 08:11:37

  • Labels added: Lang-CSharp

lukeis avatar Mar 04 '16 08:03 lukeis

Reported by luke.semerau on 2015-09-17 17:47:04

  • Labels added: Restrict-AddIssueComment-Commit

lukeis avatar Mar 04 '16 08:03 lukeis