Skip to content

Commit ebaf121

Browse files
committed
[grid] Detect Safari and SFT only when on macOS.
Helps with #12521
1 parent 4584c3c commit ebaf121

File tree

2 files changed

+28
-11
lines changed

2 files changed

+28
-11
lines changed

java/src/org/openqa/selenium/safari/SafariDriverInfo.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.Optional;
2525
import org.openqa.selenium.Capabilities;
2626
import org.openqa.selenium.ImmutableCapabilities;
27+
import org.openqa.selenium.Platform;
2728
import org.openqa.selenium.SessionNotCreatedException;
2829
import org.openqa.selenium.WebDriver;
2930
import org.openqa.selenium.WebDriverException;
@@ -65,8 +66,12 @@ public boolean isSupportingBiDi() {
6566
@Override
6667
public boolean isAvailable() {
6768
try {
68-
DriverFinder.getPath(SafariDriverService.createDefaultService(), getCanonicalCapabilities());
69-
return true;
69+
if (Platform.getCurrent().is(Platform.MAC)) {
70+
DriverFinder.getPath(
71+
SafariDriverService.createDefaultService(), getCanonicalCapabilities());
72+
return true;
73+
}
74+
return false;
7075
} catch (IllegalStateException | WebDriverException e) {
7176
return false;
7277
}
@@ -75,9 +80,12 @@ public boolean isAvailable() {
7580
@Override
7681
public boolean isPresent() {
7782
try {
78-
DriverFinder.getPath(
79-
SafariDriverService.createDefaultService(), getCanonicalCapabilities(), true);
80-
return true;
83+
if (Platform.getCurrent().is(Platform.MAC)) {
84+
DriverFinder.getPath(
85+
SafariDriverService.createDefaultService(), getCanonicalCapabilities(), true);
86+
return true;
87+
}
88+
return false;
8189
} catch (IllegalStateException | WebDriverException e) {
8290
return false;
8391
}

java/src/org/openqa/selenium/safari/SafariTechPreviewDriverInfo.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.Optional;
2525
import org.openqa.selenium.Capabilities;
2626
import org.openqa.selenium.ImmutableCapabilities;
27+
import org.openqa.selenium.Platform;
2728
import org.openqa.selenium.SessionNotCreatedException;
2829
import org.openqa.selenium.WebDriver;
2930
import org.openqa.selenium.WebDriverException;
@@ -66,9 +67,12 @@ public boolean isSupportingBiDi() {
6667
@Override
6768
public boolean isAvailable() {
6869
try {
69-
DriverFinder.getPath(
70-
SafariTechPreviewDriverService.createDefaultService(), getCanonicalCapabilities());
71-
return true;
70+
if (Platform.getCurrent().is(Platform.MAC)) {
71+
DriverFinder.getPath(
72+
SafariTechPreviewDriverService.createDefaultService(), getCanonicalCapabilities());
73+
return true;
74+
}
75+
return false;
7276
} catch (IllegalStateException | WebDriverException e) {
7377
return false;
7478
}
@@ -77,9 +81,14 @@ public boolean isAvailable() {
7781
@Override
7882
public boolean isPresent() {
7983
try {
80-
DriverFinder.getPath(
81-
SafariTechPreviewDriverService.createDefaultService(), getCanonicalCapabilities(), true);
82-
return true;
84+
if (Platform.getCurrent().is(Platform.MAC)) {
85+
DriverFinder.getPath(
86+
SafariTechPreviewDriverService.createDefaultService(),
87+
getCanonicalCapabilities(),
88+
true);
89+
return true;
90+
}
91+
return false;
8392
} catch (IllegalStateException | WebDriverException e) {
8493
return false;
8594
}

0 commit comments

Comments
 (0)