Skip to content

Commit 900bbaa

Browse files
authored
[grid] Ignored options when they are prefixed, safari specif as well (#15574)
Fixes #15481 Fixes #14485
1 parent 3d0f690 commit 900bbaa

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

java/src/org/openqa/selenium/grid/data/DefaultSlotMatcher.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class DefaultSlotMatcher implements SlotMatcher, Serializable {
4949
matched in the Node or in the browser driver.
5050
*/
5151
private static final List<String> EXTENSION_CAPABILITIES_PREFIXES =
52-
Arrays.asList("goog:", "moz:", "ms:", "se:");
52+
Arrays.asList("goog:", "moz:", "ms:", "safari:", "se:");
5353

5454
@Override
5555
public boolean matches(Capabilities stereotype, Capabilities capabilities) {
@@ -154,9 +154,12 @@ private Boolean extensionCapabilitiesMatch(Capabilities stereotype, Capabilities
154154
We match extension capabilities when they are not prefixed with any of the
155155
EXTENSION_CAPABILITIES_PREFIXES items. Also, we match them only when the capabilities
156156
of the new session request contains that specific extension capability.
157+
We are also filtering "options" extension capabilities, as they should be handled
158+
by the remote endpoint.
157159
*/
158160
return stereotype.getCapabilityNames().stream()
159161
.filter(name -> name.contains(":"))
162+
.filter(name -> !name.toLowerCase().contains("options"))
160163
.filter(name -> capabilities.asMap().containsKey(name))
161164
.filter(name -> EXTENSION_CAPABILITIES_PREFIXES.stream().noneMatch(name::contains))
162165
.map(

java/test/org/openqa/selenium/grid/data/DefaultSlotMatcherTest.java

+26
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,32 @@ void vendorExtensionPrefixedCapabilitiesAreIgnoredForMatching() {
565565
assertThat(slotMatcher.matches(stereotype, capabilities)).isTrue();
566566
}
567567

568+
@Test
569+
void extensionPrefixedOptionCapabilityIsIgnoredForMatching() {
570+
Capabilities stereotype =
571+
new ImmutableCapabilities(
572+
CapabilityType.BROWSER_NAME,
573+
"chrome",
574+
CapabilityType.BROWSER_VERSION,
575+
"84",
576+
CapabilityType.PLATFORM_NAME,
577+
Platform.WINDOWS,
578+
"node:options",
579+
"appium");
580+
581+
Capabilities capabilities =
582+
new ImmutableCapabilities(
583+
CapabilityType.BROWSER_NAME,
584+
"chrome",
585+
CapabilityType.BROWSER_VERSION,
586+
"84",
587+
CapabilityType.PLATFORM_NAME,
588+
Platform.WINDOWS,
589+
"node:options",
590+
"selenium");
591+
assertThat(slotMatcher.matches(stereotype, capabilities)).isTrue();
592+
}
593+
568594
@Test
569595
void emptyCapabilitiesDoNotMatch() {
570596
Capabilities stereotype =

0 commit comments

Comments
 (0)