code: protected static File findGhostDriver(Capabilities desiredCapabilities, String docsLink, String downloadLink) {
          // Recover path to GhostDriver from the System Properties or the Capabilities
          String ghostdriverpath;
          if (desiredCapabilities != null &&
                  desiredCapabilities.getCapability(PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY) != null) {
              ghostdriverpath = (String) desiredCapabilities.getCapability(PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY);
          } else {
              ghostdriverpath = System.getProperty(PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY);
          }
  
          if (ghostdriverpath != null) {
              // Check few things on the file before returning it
              File ghostdriver = new File(ghostdriverpath);
              checkState(ghostdriver.exists(),
                      "The GhostDriver does not exist: %s",
                      ghostdriver.getAbsolutePath());
              checkState(ghostdriver.isFile(),
                      "The GhostDriver is a directory: %s",
                      ghostdriver.getAbsolutePath());
              checkState(ghostdriver.canRead(),
                      "The GhostDriver is not a readable file: %s",
                      ghostdriver.getAbsolutePath());
  
              return ghostdriver;
          }
  
          // This means that no GhostDriver System Property nor Capability was set
          return null;
      }
docs: Find the GhostDriver main file (i.e. {@code "main.js"}).
  <br>
  Looks into the Capabilities and the System Properties for
  {@link PhantomJSDriverService#PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY}.
  <br>
  NOTE: If both the Capability and the System Property are set, the Capability takes priority.
  
  @param desiredCapabilities Capabilities in which we will look for the path to GhostDriver
  @param docsLink            The link to the GhostDriver documentation page
  @param downloadLink        The link to the GhostDriver download page
  @return The driver executable as a {@link File} object
  @throws IllegalStateException If the executable not found or cannot be executed