Skip to content

Commit 7e0978c

Browse files
committed
[grid] Add method to check if slot supports BiDi
1 parent 5bf00b4 commit 7e0978c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

java/src/org/openqa/selenium/grid/node/local/SessionSlot.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public class SessionSlot implements
5959
private final SessionFactory factory;
6060
private final AtomicBoolean reserved = new AtomicBoolean(false);
6161
private final boolean supportingCdp;
62+
private final boolean supportingBiDi;
6263
private ActiveSession currentSession;
6364

6465
public SessionSlot(EventBus bus, Capabilities stereotype, SessionFactory factory) {
@@ -67,6 +68,7 @@ public SessionSlot(EventBus bus, Capabilities stereotype, SessionFactory factory
6768
this.stereotype = ImmutableCapabilities.copyOf(Require.nonNull("Stereotype", stereotype));
6869
this.factory = Require.nonNull("Session factory", factory);
6970
this.supportingCdp = isSlotSupportingCdp(this.stereotype);
71+
this.supportingBiDi = isSlotSupportingBiDi(this.stereotype);
7072
}
7173

7274
public UUID getId() {
@@ -160,12 +162,22 @@ public boolean isSupportingCdp() {
160162
return supportingCdp;
161163
}
162164

165+
public boolean isSupportingBiDi() {
166+
return supportingBiDi;
167+
}
168+
163169
private boolean isSlotSupportingCdp(Capabilities stereotype) {
164170
return StreamSupport.stream(ServiceLoader.load(WebDriverInfo.class).spliterator(), false)
165171
.filter(webDriverInfo -> webDriverInfo.isSupporting(stereotype))
166172
.anyMatch(WebDriverInfo::isSupportingCdp);
167173
}
168174

175+
private boolean isSlotSupportingBiDi(Capabilities stereotype) {
176+
return StreamSupport.stream(ServiceLoader.load(WebDriverInfo.class).spliterator(), false)
177+
.filter(webDriverInfo -> webDriverInfo.isSupporting(stereotype))
178+
.anyMatch(WebDriverInfo::isSupportingBiDi);
179+
}
180+
169181
public boolean hasRelayFactory() {
170182
return factory instanceof RelaySessionFactory;
171183
}

0 commit comments

Comments
 (0)