Skip to content

Commit 11e5fa8

Browse files
committed
SafariDriver is dead. Long live SafariDriver!
Java only using safaridriver provided by Apple now.
1 parent 9bfdc37 commit 11e5fa8

File tree

2 files changed

+3
-289
lines changed

2 files changed

+3
-289
lines changed

java/client/src/org/openqa/selenium/safari/SafariDriver.java

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,6 @@
3737
*/
3838
public class SafariDriver extends RemoteWebDriver {
3939

40-
/**
41-
* Capability to force usage of the deprecated SafariDriver extension while running
42-
* on macOS Sierra.
43-
*
44-
* <pre>
45-
* DesiredCapabilities safariCap = DesiredCapabilities.Safari();
46-
* safariCap.setCapability(SafariDriver.USE_LEGACY_DRIVER_CAPABILITY, true);
47-
* WebDriver driver = new SafariDriver(safariCap);
48-
* </pre>
49-
*/
50-
public static final String USE_LEGACY_DRIVER_CAPABILITY = "useLegacyDriver";
51-
5240
private SafariDriverService service;
5341

5442
/**
@@ -82,23 +70,15 @@ public SafariDriver(SafariOptions safariOptions) {
8270
* Ensure the new safaridriver receives non null required capabilities.
8371
*/
8472
private static Capabilities requiredCapabilities(SafariOptions options) {
85-
if (isLegacy(options)) {
86-
return null;
87-
}
8873
return new DesiredCapabilities();
8974
}
9075

9176
private static CommandExecutor getExecutor(SafariOptions options) {
9277
SafariDriverService service = SafariDriverService.createDefaultService(options);
93-
if (isLegacy(options) && service != null) {
94-
return new DriverCommandExecutor(service);
78+
if (service == null) {
79+
throw new WebDriverException("SafariDriver requires Safari 10 running on OSX El Capitan or greater.");
9580
}
96-
return new SafariDriverCommandExecutor(options);
97-
}
98-
99-
private static boolean isLegacy(SafariOptions options) {
100-
Object useLegacy = options.toCapabilities().getCapability(USE_LEGACY_DRIVER_CAPABILITY);
101-
return useLegacy != null && (Boolean)useLegacy;
81+
return new DriverCommandExecutor(service);
10282
}
10383

10484
@Override
@@ -107,36 +87,4 @@ public void setFileDetector(FileDetector detector) {
10787
"Setting the file detector only works on remote webdriver instances obtained " +
10888
"via RemoteWebDriver");
10989
}
110-
111-
@Override
112-
protected void startClient() {
113-
CommandExecutor commandExecutor = this.getCommandExecutor();
114-
if (commandExecutor instanceof SafariDriverCommandExecutor) {
115-
try {
116-
((SafariDriverCommandExecutor)commandExecutor).start();
117-
} catch (IOException e) {
118-
throw new WebDriverException(e);
119-
}
120-
} else {
121-
super.startClient();
122-
}
123-
}
124-
125-
@Override
126-
protected void stopClient() {
127-
CommandExecutor commandExecutor = this.getCommandExecutor();
128-
if (commandExecutor instanceof SafariDriverCommandExecutor) {
129-
((SafariDriverCommandExecutor)commandExecutor).stop();
130-
} else {
131-
super.stopClient();
132-
}
133-
}
134-
135-
@Override
136-
public <X> X getScreenshotAs(OutputType<X> target) throws WebDriverException {
137-
// Get the screenshot as base64.
138-
String base64 = (String) execute(DriverCommand.SCREENSHOT).getValue();
139-
// ... and convert it.
140-
return target.convertFromBase64Png(base64);
141-
}
14290
}

java/client/src/org/openqa/selenium/safari/SafariDriverCommandExecutor.java

Lines changed: 0 additions & 234 deletions
This file was deleted.

0 commit comments

Comments
 (0)