code: public Object executePhantomJS(String script, Object... args) {
          script = script.replaceAll("\"", "\\\"");
  
          Iterable<Object> convertedArgs = Iterables.transform(
                  Lists.newArrayList(args), new WebElementToJsonConverter());
          Map<String, ?> params = ImmutableMap.of(
                  "script", script, "args", Lists.newArrayList(convertedArgs));
  
          return execute(COMMAND_EXECUTE_PHANTOM_SCRIPT, params).getValue();
      }
docs: Execute a PhantomJS fragment.  Provides extra functionality not found in WebDriver
  but available in PhantomJS.
  <br>
  See the <a href="http://phantomjs.org/api/">PhantomJS API</a>
  for details on what is available.
  <br>
  The javascript this keyword points to the currently selected page that is available for use.
  If there is no page yet, one is created.
  <br>
  When overriding any callbacks be sure to wrap in a try/catch block, as failures
  may cause future WebDriver calls to fail.
  <br>
  Certain callbacks are used by GhostDriver (the PhantomJS WebDriver implementation)
  already.  Overriding these may cause the script to fail.  It's a good idea to check
  for existing callbacks before overriding.
  
  @param script The fragment of PhantomJS JavaScript to execute.
  @param args List of arguments to pass to the function that the script is wrapped in.
  These can accessed in the script as 'arguments[0]', 'arguments[1]',
  'arguments[2]', etc
  @return The result of the evaluation.