I couldn't find it referenced in the documentation but since PhantomJs is now at 2.1, Is there a way to use a WebSocket to interface NodeJs and PhantomJs directly or am I better going with StdIn/StdOut?
I'd like to skip the step of spawning a webserver plus a fake webpage to catch the events like I've seen on many github. If I can I would avoid those ninja tricks.
You really don't need WebSockets or the Web Server module.
There are basically two ways to use PhantomJS from node.js:
Write a plain PhantomJS script and spawn a PhantomJS process that executes that script, but this doesn't provide easy interactivity
Interface with PhantomJS through the many available bridges so that you can mix PhantomJS code with node.js code:
phantom , node-phantom , nightmare (version <1.8 used PhantomJS, now it's Electron), Horseman , navit , phridge , node-phantom-simple , jquery.go.js , SpookyJS (wrapper around CasperJS, which is a wrapper around PhantomJS), Selenium-Webdriver (JavaScript bindings), webdriver.io (other JS bindings for Selenium), etc.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.