code: public void exec(final MainRemote.Script script) throws Exception {
          final File file = File.createTempFile("takes-", ".txt");
          if (!file.delete()) {
              throw new IOException(
                  String.format(
                      // @checkstyle LineLength (1 line)
                      "The temporary file '%s' could not be deleted before calling the exec method",
                      file.getAbsolutePath()
                  )
              );
          }
          final Method method = this.app.getDeclaredMethod(
              "main", String[].class
          );
          final String[] passed = new String[1 + this.args.length];
          passed[0] = String.format("--port=%s", file.getAbsoluteFile());
          for (int idx = 0; idx < this.args.length; ++idx) {
              passed[idx + 1] = this.args[idx];
          }
          final Thread thread = new Thread(new MainMethod(method, passed));
          thread.start();
          try {
              script.exec(
                  URI.create(
                      String.format(
                          "http://localhost:%d",
                          MainRemote.port(file)
                      )
                  )
              );
          } catch (final IOException ex) {
              if (!file.delete()) {
                  ex.addSuppressed(
                      new IOException(
                          String.format(
                              // @checkstyle LineLength (1 line)
                              "The temporary file '%s' could not be deleted while catching the error",
                              file.getAbsolutePath()
                          )
                      )
                  );
              }
              throw ex;
          } finally {
              thread.interrupt();
          }
          if (!file.delete()) {
              throw new IOException(
                  String.format(
                      // @checkstyle LineLength (1 line)
                      "The temporary file '%s' could not be deleted after calling the exec method",
                      file.getAbsolutePath()
                  )
              );
          }
      }
docs: Execute this script against a running front.
  @param script Script to run
  @throws Exception If fails