Skip to content

Commit

Permalink
[grid] Detect Safari and SFT only when on macOS.
Browse files Browse the repository at this point in the history
Helps with #12521
  • Loading branch information
diemol committed Aug 28, 2023
1 parent 4584c3c commit ebaf121
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
18 changes: 13 additions & 5 deletions java/src/org/openqa/selenium/safari/SafariDriverInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.Optional;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.ImmutableCapabilities;
import org.openqa.selenium.Platform;
import org.openqa.selenium.SessionNotCreatedException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
Expand Down Expand Up @@ -65,8 +66,12 @@ public boolean isSupportingBiDi() {
@Override
public boolean isAvailable() {
try {
DriverFinder.getPath(SafariDriverService.createDefaultService(), getCanonicalCapabilities());
return true;
if (Platform.getCurrent().is(Platform.MAC)) {
DriverFinder.getPath(
SafariDriverService.createDefaultService(), getCanonicalCapabilities());
return true;
}
return false;
} catch (IllegalStateException | WebDriverException e) {
return false;
}
Expand All @@ -75,9 +80,12 @@ public boolean isAvailable() {
@Override
public boolean isPresent() {
try {
DriverFinder.getPath(
SafariDriverService.createDefaultService(), getCanonicalCapabilities(), true);
return true;
if (Platform.getCurrent().is(Platform.MAC)) {
DriverFinder.getPath(
SafariDriverService.createDefaultService(), getCanonicalCapabilities(), true);
return true;
}
return false;
} catch (IllegalStateException | WebDriverException e) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.Optional;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.ImmutableCapabilities;
import org.openqa.selenium.Platform;
import org.openqa.selenium.SessionNotCreatedException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
Expand Down Expand Up @@ -66,9 +67,12 @@ public boolean isSupportingBiDi() {
@Override
public boolean isAvailable() {
try {
DriverFinder.getPath(
SafariTechPreviewDriverService.createDefaultService(), getCanonicalCapabilities());
return true;
if (Platform.getCurrent().is(Platform.MAC)) {
DriverFinder.getPath(
SafariTechPreviewDriverService.createDefaultService(), getCanonicalCapabilities());
return true;
}
return false;
} catch (IllegalStateException | WebDriverException e) {
return false;
}
Expand All @@ -77,9 +81,14 @@ public boolean isAvailable() {
@Override
public boolean isPresent() {
try {
DriverFinder.getPath(
SafariTechPreviewDriverService.createDefaultService(), getCanonicalCapabilities(), true);
return true;
if (Platform.getCurrent().is(Platform.MAC)) {
DriverFinder.getPath(
SafariTechPreviewDriverService.createDefaultService(),
getCanonicalCapabilities(),
true);
return true;
}
return false;
} catch (IllegalStateException | WebDriverException e) {
return false;
}
Expand Down

0 comments on commit ebaf121

Please sign in to comment.