1818package org .openqa .selenium .safari ;
1919
2020import com .google .common .collect .ImmutableMap ;
21+
2122import org .openqa .selenium .Beta ;
2223import org .openqa .selenium .Capabilities ;
2324import org .openqa .selenium .WebDriverException ;
@@ -68,7 +69,7 @@ public SafariDriver(Capabilities desiredCapabilities) {
6869 * @param safariOptions safari specific options / capabilities for the driver
6970 */
7071 public SafariDriver (SafariOptions safariOptions ) {
71- this (SafariDriverService .createDefaultService (safariOptions ), safariOptions );
72+ this (SafariDriverService .createDefaultService (), safariOptions );
7273 }
7374
7475 /**
@@ -91,6 +92,11 @@ public SafariDriver(SafariDriverService safariServer, SafariOptions safariOption
9192 debugger = new AddHasDebugger ().getImplementation (getCapabilities (), getExecuteMethod ());
9293 }
9394
95+ @ Beta
96+ public static RemoteWebDriverBuilder builder () {
97+ return RemoteWebDriver .builder ().oneOf (new SafariOptions ());
98+ }
99+
94100 @ Override
95101 public void setPermissions (String permission , boolean value ) {
96102 Require .nonNull ("Permission Name" , permission );
@@ -109,6 +115,13 @@ public void attachDebugger() {
109115 debugger .attachDebugger ();
110116 }
111117
118+ @ Override
119+ public void setFileDetector (FileDetector detector ) {
120+ throw new WebDriverException (
121+ "Setting the file detector only works on remote webdriver instances obtained " +
122+ "via RemoteWebDriver" );
123+ }
124+
112125 private static class SafariDriverCommandExecutor extends DriverCommandExecutor {
113126 public SafariDriverCommandExecutor (DriverService service ) {
114127 super (service , getExtraCommands ());
@@ -121,16 +134,4 @@ private static Map<String, CommandInfo> getExtraCommands() {
121134 .build ();
122135 }
123136 }
124-
125- @ Override
126- public void setFileDetector (FileDetector detector ) {
127- throw new WebDriverException (
128- "Setting the file detector only works on remote webdriver instances obtained " +
129- "via RemoteWebDriver" );
130- }
131-
132- @ Beta
133- public static RemoteWebDriverBuilder builder () {
134- return RemoteWebDriver .builder ().oneOf (new SafariOptions ());
135- }
136137}
0 commit comments