-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
[🚀 Feature]: Selenium 4 Grid Slot Matching RFC #15481
Comments
@sbabcoc, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable
After troubleshooting the issue, please add the Thank you! |
Wait, how do we match on If we filter out I don't like the idea of artificially declaring some values to be identity and some to be configuration. It's an arbitrary distinction that isn't in the spec. I'd like to go the other direction and not treat any capabilities as special. Everything that I know of implements My question is: why do we need to treat any of these keys as special if the user isn't going to manually put them the stereotype? Is there some place where a more complicated stereotype is automatically generated? |
@titusfortner The check for As stated in this RFC, the purpose of capability differentiation is to enable vendors to decide which capabilities should be considered for slot matching, and which should be passed on to selected end nodes without analysis. This is currently only possible via custom slot matchers, which are mutually exclusive per hub. Another possible mechanism to enable vendor-specific behavior would be to add another method to WebDriverInfo to enable vendors to extend or override the matching performed by DefaultSlotMatcher. Regarding the concept of formally defining two distinct capability categories versus how things are defined in the specification, I'm unaware of any detailed specifications for Selenium Grid, let alone the esoteric details of slot matching. As such, the implementation is the spec. The W3C WebDriver spec provides a lot of wiggle room regarding the handling of extension capabilities. It even presents the option of defining routing-specific capabilities to control how intermediate nodes match "new session" requests with compatible end nodes. This feature could potentially introduce an additional capability category (routing options), but I don't think this is strictly necessary. |
I know I'm trying to understand why the existing implementation is like that. (and we probably need to wait until after the conference for the Grid experts to have time to answer) 😄 |
Regarding the handling of The goal of this RFC is to replace the current arbitrary disparities in how extension capabilities are handled with a defined pattern to differentiate "identity" values from configuration options. This will enable vendors to explicitly select the treatment they need, and it will remove the ambiguities currently faced by Grid creators and Grid users. |
In DefaultSlotMatcher, there is a comment for
When you are reading Appium v2 docs. You will see 2 ways to pass the
I think we should remove this |
This is valid. For example, if you consider the case of Apple, we can add its vendor prefix too. |
Another thing that I can see is if you are referring to the Appium test through Grid using Relay Node. The matching is involved another implementation in |
@VietND96 The To treat all prefixes uniformly, all extension capabilities except those beginning with The matching performed by RelaySessionFactory will also be revised to remove Appium-specific implementation. The updated matching performed by DefaultSlotMatcher will no longer require this implementation. |
I am not sure how you can test with
Here is the Appium tests through Grid that I tried locally, for both hybrid browser session and native app, it works - https://github.com/NDViet/test-grid-relay-appium |
The extension capability I have an open PR that implements the patterns of this RFC here: #14485 |
@VietND96 Appium works with Grid though Relay, but the way we've implemented extension capability support is inconsistent and inflexible. My local-grid-parent project is able to stand up Grid instances that support all flavors of Appium engines. Configuration of such instances is not trivial, and much of the complexity is rooted in the handling of extension capabilities. |
I agree on removing I still am confused about why we need to treat any of these keywords as "non-identity" values. Aren't we iterating over the stereotype, not the capabilities? In which case if it isn't in the stereotype it doesn't matter? |
@titusfortner As currently implemented, all extension capabilities with "special" prefixes are ignored for slot matching (configuration options), while all other extension capabilities are considered for slot matching ("identity" values). This is why RelaySessionFactory currently contains Appium-specific implementation - to filter out a value merged from the relay stereotype that would otherwise cause session creation to fail. |
The merge operation enables the relay to define common configuration options (e.g. - BrowserStack access tokens) so the client doesn't need to specify these, or even know that they exist. These serve as overridable default settings, which configure the selected node without affecting the slot matching process. |
Capabilities from Google, Mozilla, and Microsoft need to be passed along to the browser driver, who can use them to match or extract values for session creation. That is why they do not need to be matched. Defining any capability with a Google, Mozilla, or Microsoft prefix does not make sense because the driver will use the values present. For example. Apple-specific capabilities are uncommon in session requests, so we are not excluding them. This is probably a mistake, and we could change our approach and start ignoring them. Appium-specific capabilities are also not entirely ignored because the Appium server does not create the session but uses them to validate and find the correct driver, which then uses those capabilities to create the session. The Appium server is also an intermediary node. That is why it makes sense to help with the matching early enough and avoid delaying this process. I think it makes sense to ignore capabilities with an In addition, custom slot matchers exist because a group of users relies on them to handle their infrastructure without the need to tell the users to specify more capabilities. |
We need to do that match early because if we avoid it, then a session will be matched with a Relay Node that connects an Appium server that could not support the |
Removing the |
@diemol Appium and Safari both define "identity" values that should be considered for slot matching and configuration options that should not be considered for slot matching. In the Appium case, For Chrome, The proposal of this RFC is that we eliminate the inconsistent handling of extension capabilities and define patterns to differentiate "identity" values from configuration options.
|
Because this is not the responsibility of the
Again, that is why you can implement your custom Matcher.
The inconsistency you claim is based on assumptions you have. The use cases you mention are not the responsibility of the |
@diemol The core issue with custom matchers is that each hub can only specify one matcher. There's no mechanism to extend the default matcher; it can only be replaced. This sledgehammer approach should be reserved for uncommon scenarios, not normal cases like the ones highlighted in my examples. The inconsistencies cited in this RFC have been clearly defined. We treat extension capabilities with "special" prefixes one way and every other extension capability in precisely the opposite way. |
How many matchers do you need? You can implement your own with all the logic you need to handle each case. Your examples are not the common use cases, no one has mentioned them in over 2-3 years. |
@diemol The current mechanism forces arbitrary separations between hubs that support sessions from different vendors. Each vendor that requires matching behavior that deviates from "default" must be vended by a separate grid instance. The patterns specified in this RFC eliminate these arbitrary separations. Regarding mention of vendor-specific slot matching issues, there have been several revisions in the last three years to resolve these sorts of issues. Also, the ability to run remote HtmlUnit sessions in Selenium 4 Grid was introduced less than a year ago. This is the point at which I first fully recognized the inconsistencies in slot matching behavior, and I've been working on solutions ever since. |
Selenium 4 Grid Slot Matching RFC
Background
A core feature of Selenium 4 Grid is slot matching – the process of pairing a client “new session” request with a node that can satisfy the request. This process involves evaluating the client’s desired capabilities against the stereotypes of available nodes to determine which (if any) matches the request. The default implementation is defined in a class named DefaultSlotMatcher.
Implementation Details of DefaultSlotMatcher
platformName
capabilityplatformVersion
capability:platformVersion
goog:
,moz:
,ms:
, orse:
browserName
capability:browserName
value is undefined or emptybrowserName
capability has the desired valuebrowserVersion
capability:browserVersion
value is undefined, empty, or “stable”browserVersion
platformName
capability:platformName
value is undefinedplatformName
capability has the desired valueplatformName
Current Issue – Extension Capability Handling
As currently implemented, DefaultSlotMatcher has one obvious issue at Step 4 in its handling of extension capabilities. It ignores the extension capabilities of three vendors (Google, Mozilla, and Microsoft), but considers the extension capabilities of every other vendor (including Appium and Apple). This produces inconsistent slot matching behavior, with Appium extension capabilities causing slot matching to fail while similar Google extension capabilities would have no ill effect.
Solution – Capability Type Differentiation
The existing handling of extension capabilities for the three “special” vendors suggests that capabilities might be divided into two distinct categories: “identity” values that are considered for slot matching and configuration options that are transmitted to the matched node without analysis.
Patterns from Current Usage
In current usage, values defined within “options” extension capability objects should be ignored for slot matching (i.e. – configuration options). Two additional extension capabilities are also currently ignored:
<prefix>:debuggerAddress
and<prefix>:loggingPrefs
. Every other defined capability for the three “special” vendors is treated as an “identity” value. However, these categories are merely incidental, not formally defined within the specifications. Consequently, there’s no defined mechanism for vendors to add new “identity” values or configuration options.Proposal: Formally Define Capability Type Differentiation
Formalizing the current implied categorization of capabilities into “identity” values and configuration options will provide two distinct benefits:
Definition of configuration options
The proposed definition for configuration options, which will be ignored for purposes of slot matching:
se:
(Selenium).options
Options
loggingPrefs
debuggerAddress
Definition of “identity” values
All capabilities that don’t conform with the definition of configuration options as defined above will be treated as “identity” values, which will be considered for purposes of slot matching. This includes extension capabilities with “special” prefixes that would previously have been ignored. This change is merely academic, though, given that there are no currently defined “special” extension capabilities that are affected by the revised behavior.
Usage example
This feature will be implemented in DefaultSlotMatcher. Consequently, anyone using Selenium 4 Grid without explicitly configuring a custom slot matcher will encounter the revised behavior.
The text was updated successfully, but these errors were encountered: