@@ -166,23 +166,27 @@ public FirefoxDriver(Capabilities desiredCapabilities) {
166166
167167 private static FirefoxOptions getFirefoxOptions (Capabilities capabilities ) {
168168 FirefoxOptions options = new FirefoxOptions ();
169- if ( capabilities != null ) {
170- Object rawOptions = capabilities . getCapability ( FIREFOX_OPTIONS );
171- if ( rawOptions != null ) {
172- if ( rawOptions instanceof Map ) {
173- try {
174- @ SuppressWarnings ( "unchecked" )
175- Map < String , Object > map = ( Map < String , Object >) rawOptions ;
176- rawOptions = FirefoxOptions . fromJsonMap ( map );
177- } catch ( IOException e ) {
178- throw new WebDriverException ( e );
179- }
180- }
181- if ( rawOptions != null && !( rawOptions instanceof FirefoxOptions ) ) {
182- throw new WebDriverException ("Firefox option was set, but is not a FirefoxOption: " + rawOptions );
169+
170+ if ( capabilities == null ) {
171+ return options ;
172+ }
173+
174+ Object rawOptions = capabilities . getCapability ( FIREFOX_OPTIONS );
175+ if ( rawOptions != null ) {
176+ if ( rawOptions instanceof Map ) {
177+ try {
178+ @ SuppressWarnings ( "unchecked" )
179+ Map < String , Object > map = ( Map < String , Object >) rawOptions ;
180+ rawOptions = FirefoxOptions . fromJsonMap ( map );
181+ } catch ( IOException e ) {
182+ throw new WebDriverException (e );
183183 }
184- options = (FirefoxOptions ) rawOptions ;
185184 }
185+ if (rawOptions != null && !(rawOptions instanceof FirefoxOptions )) {
186+ throw new WebDriverException (
187+ "Firefox option was set, but is not a FirefoxOption: " + rawOptions );
188+ }
189+ options = (FirefoxOptions ) rawOptions ;
186190 }
187191 return options ;
188192 }
0 commit comments