I used Coypu , which, as I found, is a beautiful shell for automating the browser. Thanks to this, you can use HtmlUnit, a mute browser that, as I understand it, supports some javascript (in fact, the driver inside Coypu calls HtmlUnitWithJavascript). I have not tried the HtmlUnit driver yet, but Coypu itself is very good (and I'm sure you could use HtmlUnit outside of Coypu too.)
For some ideas see https://github.com/featurist/coypu#htmlunit .
source share