-
-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add AddAdditionalCapability(string capabilityName, object capabilityValue, bool isGlobalCapability) overload to DriverOptions #6563
Comments
I would like to second this. A simple abstract method on the parent DriverOptions class that overloads AddAdditionalCapability with a boolean variable (exactly how all of the children classes are already doing) would allow us to avoid @ohadschn 's example. |
Alright, here's the problem. The name
People are free to disagree with this approach, but silently changing the semantics of the existing method (i.e., eliminating the three-argument overload behavior) seems hostile, and there is no compelling use case for having a method that adds browser-specific capabilities, if no browser-specific capabilities exist. Please be mindful of how your phrase your disagreements in this issue report; I would rather not have to shut off all discussion by locking the issue. Downstream projects such as Appium will need to be aware of these changes, and adjust their subclasses accordingly. |
So basically starting version 4.0 the code I presented above could simply be written as |
@ohadschn That’s the idea. |
With the refactor of the |
The current state is inconsistent:
ChromeOptions
,FirefoxOptions
, andInternetExplorerOptions
each have their ownAddAdditionalCapability(string, object, bool)
overload (unrelated in terms of polymorphism).SafariOptions
andEdgeOptions
don't aAddAdditionalCapability(string, object, bool)
overload at all.This means that you can't share code and have to have undesirable casts like the following:
Note how the exact same call has to be written multiple times due to said lack of polymorphism.
This API discrepancy also demonstrates inconsistency between the semantics of
AddAdditionalCapability(string capabilityName, object capabilityValue)
. For Chrome, FF, and IE it adds browser-specific capabilities (by defaulting toisGlobalCapability = false
), whereas for Safari and Edge it adds global capabilities (the equivalent of defaulting toisGlobalCapability = true
had there been a similar overload accepting the latter).The text was updated successfully, but these errors were encountered: