File tree Expand file tree Collapse file tree
java/client/src/org/openqa/selenium/firefox Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3939import java .io .File ;
4040import java .io .IOException ;
4141import java .io .OutputStream ;
42+ import java .nio .file .Files ;
43+ import java .nio .file .Path ;
4244import java .util .Collections ;
4345import java .util .HashSet ;
4446import java .util .List ;
@@ -439,7 +441,26 @@ private static Stream<Executable> locateFirefoxBinariesFromPlatform() {
439441
440442 String systemFirefox = CommandLine .find ("firefox" );
441443 if (systemFirefox != null ) {
442- executables .add (new Executable (new File (systemFirefox )));
444+ Path firefoxPath = new File (systemFirefox ).toPath ();
445+ if (Files .isSymbolicLink (firefoxPath )) {
446+ try {
447+ Path realPath = Files .readSymbolicLink (firefoxPath );
448+ File attempt1 = realPath .getParent ().resolve ("firefox" ).toFile ();
449+ if (attempt1 .exists ()) {
450+ executables .add (new Executable (attempt1 ));
451+ } else {
452+ File attempt2 = realPath .getParent ().resolve ("firefox-bin" ).toFile ();
453+ if (attempt2 .exists ()) {
454+ executables .add (new Executable (attempt2 ));
455+ }
456+ }
457+ } catch (IOException e ) {
458+ // ignore this path
459+ }
460+
461+ } else {
462+ executables .add (new Executable (new File (systemFirefox )));
463+ }
443464 }
444465
445466 return executables .build ().stream ();
You can’t perform that action at this time.
0 commit comments