code: protected static File findPhantomJS(Capabilities desiredCapabilities, String docsLink,
                                          String downloadLink) {
          String phantomjspath;
          if (desiredCapabilities != null &&
                  desiredCapabilities.getCapability(PHANTOMJS_EXECUTABLE_PATH_PROPERTY) != null) {
              phantomjspath = (String) desiredCapabilities.getCapability(PHANTOMJS_EXECUTABLE_PATH_PROPERTY);
          } else {
              phantomjspath = new ExecutableFinder().find(PHANTOMJS_DEFAULT_EXECUTABLE);
              phantomjspath = System.getProperty(PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomjspath);
          }
  
          checkState(phantomjspath != null,
                  "The path to the driver executable must be set by the %s capability/system property/PATH variable;"
                          + " for more information, see %s. "
                          + "The latest version can be downloaded from %s",
                  PHANTOMJS_EXECUTABLE_PATH_PROPERTY,
                  docsLink,
                  downloadLink);
  
          File phantomjs = new File(phantomjspath);
          checkExecutable(phantomjs);
          return phantomjs;
      }
docs: Looks into the Capabilities, the current $PATH and the System Properties for
  {@link PhantomJSDriverService#PHANTOMJS_EXECUTABLE_PATH_PROPERTY}.
  <br>
  NOTE: If the Capability, the $PATH and the System Property are set, the Capability takes
  priority over the System Property, that in turn takes priority over the $PATH.
  
  @param desiredCapabilities Capabilities in which we will look for the path to PhantomJS
  @param docsLink            The link to the PhantomJS documentation page
  @param downloadLink        The link to the PhantomJS download page
  @return The driver executable as a {@link File} object
  @throws IllegalStateException If the executable not found or cannot be executed