Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for JFX WebKit Component #138

Open
plexus opened this issue Jun 28, 2017 · 1 comment
Open

Add support for JFX WebKit Component #138

plexus opened this issue Jun 28, 2017 · 1 comment

Comments

@plexus
Copy link

plexus commented Jun 28, 2017

Since Java 8 any Java distribution comes with a complete Webkit inside it as part of JFX. (docs)

It would be fantastic to have support for that in doo, since it would give people a complete headless browser without having to install anything extra.

The Sparkledriver library already provides a nice Clojure interface.

I might get to this myself, but I'm not familiar with the doo sources, and it might be a while before I find the time, so just leaving this here in case someone else wants to tackle this.

@plexus
Copy link
Author

plexus commented Jul 4, 2017

A few notes to myself for later reference:

Running some JS code with SparkleDriver looks like this

(require '[sparkledriver.core :refer [with-browser make-browser]]) 
(with-browser [browser (make-browser)]
  ;; needs a DOM loaded to work, data uri for <html></html>
  (fetch! browser "data:text/html;charset=utf-8;base64,PGh0bWw+PC9odG1sPg==")
  (.executeScript browser (slurp "file-path") (into-array String []))

See the JBrowserDriver docs for getting results back from JavaScript.

To handle the jfx case in doo it might be enough to have a big (if (= :sparkledriver js-env) here https://github.com/bensu/doo/blob/master/library/src/doo/core.clj#L262 and fall back to the regular shelling out if the env isn’t sparkledriver/jfx. (thanks @martinklepsch for the tip).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant