Rhino and Envjs
From the Rhino downloads page I downloaded rhino1_7R2.zip since R3 doesn’t work with Envjs at the time of this post.
I also downloaded the latest Envjs and placed it in the same location as the unzipped rhino folder.
Navigate in a terminal to the location of the unziped rhino folder and start up rhino.
java -jar js.jar
Then I tell Envjs to load external scripts found in the page. This is required because scripts running in Rhino with Envjs will have file system access.
Then we navigate our emulated browser to the test page that I built.
window.location = "http://mikegrace.s3.amazonaws.com/geek-blog/rhino-envjs.html"
This is because the page content is built using jQuery
Rhino and Envjs Test
Because Envjs will emulate a browser, we will be able to work with the page in Rhino like we would in a browser.
Getting the paragraph text is as easy as running some jQuery in the Rhino console