-
-
Couldn't load subscription status.
- Fork 8.6k
[dotnet] Remove client side validation of well-known Options #16120
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
base: trunk
Are you sure you want to change the base?
[dotnet] Remove client side validation of well-known Options #16120
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
|
OMG! var options = new ChromeOptions();
options.AddAdditionalOption("myCustomOption", "myCastomValue");
using var driver = new ChromeDriver(options);It silently ignores unknown options! :( |
|
Tagging @SeleniumHQ/selenium-committers team. Do you strange situation as me? |
Maybe I’m not fully understanding… but since we’re removing our validation, then we’re putting the onus on the driver devs. I’m not sure what to do but notify them of this issue and hope they resolve it |
|
Here we should choose between:
The second option is unacceptable IMHO. |
|
@SeleniumHQ/selenium-tlc needs to decide on this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I understand what this is doing, but it would be good to add a test that would not have passed under existing code that will now work with this change.
Otherwise, I think this is a good update.
I don't see a good place where to add it, there is no kind of existing verifications. Please suggest. |
|
Ping pong. |
|
It is a well-known state of affairs that custom/third-party capabilities have a prefix and a colon, eg. This PR basically allows first-party capabilities to be defined without validation that it is a real property. Is this desirable? What do other bindings do? Is the behavior for a non-existent capability defined by the spec? If not, what does each browser do?
I agree that this isn’t good. Do we know if that was a design choice, or just something that happened to be? It would be a breaking change, is it too big of one? If possible, we should throw on unknown first-party capabilities. |
|
Java allows it somehow, user provided gist how to do it. |
User description
This resolves design issue in .NET driver options class. Options class is a wrapper of well-known supported remote-end options, usually via strong typing. But meanwhile there is
AddAdditionalOption(...)method which allows user to do what he wants.The issue in design is that
AddAdditionalOption(...)method doesn't allow user what he wants because this method dictates to use another API. This is really bad, at compile time user is going to do something legible, but gets weird exception in runtime.🔗 Related Issues
It contributes to #16102, but doesn't resolve completely.
💥 What does this PR do?
Do not validate that user uses Selenium library improperly, he uses it correctly.
🔄 Types of changes
PR Type
Bug fix
Description
Remove client-side validation preventing legitimate API usage
Clean up constructor code removing capability name tracking
Simplify
ValidateCapabilityNamemethod implementationFix design issue with
AddAdditionalOptionmethod restrictionsDiagram Walkthrough
File Walkthrough
DriverOptions.cs
Remove capability validation infrastructuredotnet/src/webdriver/DriverOptions.cs
ValidateCapabilityNameto only check for null/emptyChromiumOptions.cs
Remove ChromiumOptions constructor validationdotnet/src/webdriver/Chromium/ChromiumOptions.cs
AddKnownCapabilityNamecallsFirefoxOptions.cs
Clean up FirefoxOptions constructordotnet/src/webdriver/Firefox/FirefoxOptions.cs
AddKnownCapabilityNamecalls from constructorInternetExplorerOptions.cs
Clean up InternetExplorerOptions constructordotnet/src/webdriver/IE/InternetExplorerOptions.cs
AddKnownCapabilityNamecalls from constructorSafariOptions.cs
Clean up SafariOptions constructordotnet/src/webdriver/Safari/SafariOptions.cs
AddKnownCapabilityNamecalls from constructor