Unix swiss army knife for headless browser JavaScript
github.com
github.com
Headless Browser Javasrcipt Toolhttps://github.com/sotownsend/BooJS/blob/master/lib/boojs.rb...
I threw together a similar implementation in bash with this change:
https://gist.github.com/spence/30d5aa383fec6be8e51e
Looks like
./phantomjs-repl.sh
> missing
ReferenceError: Can't find variable: missing
> window
[object Window]
> console.log('Hello')
Hello
undefined
> !jquery-1.11.2.min.js
Loading jquery-1.11.2.min.js ... done
> $('<span>Hello</span>').text()
Hello
> ^Ctl;dr: CLI program wrapping PhantomJS, which is based on QtWebkit.
P.S. I do kernel development on FreeBSD in my spare time. I know a little bit about unix, ya know?
Edited due to parent edit: I'm...happy for you that you develop on the FreeBSD kernel? I'm also not sure how that is relevant to the discussion of why this tool should be used over any other of the dozens of headless toolkits and wrappers out there - and your readme certainly doesn't do any work to convince me to care about your implementation over any existing solution. You're surprisingly defensive for someone claiming to be confident in their development skills, I'm not your enemy here - I was, until this exchange, a potential user (and may yet be, I'm not one to pass over a good tool simply for personal reasons).
2. Write a wrapper around it claim its good as a real browser.
3. Plug company name
4. Profit ??
Btw, it is just a CLI wrapper around PhantomJS[1] I guess.
(And piss off people who hate JS "apps" or still desire the HTTP/HTML document ideal, for better or for worse.)
Then their jets started falling left and right and they ended up installing it back again.
Came to a lot of this knowledge when changing a url structure for a few hundred thousand pages (with permanent redirects in place)... the bing bot results on analytics were really surprising, and had to adjust filtering.
running unix command from java
http://www.unix.com/unix-for-dummies-questions-and-answers/1...
[1] http://code.tutsplus.com/tutorials/headless-functional-testi...
Did they fix the memory leak issues in PhantomJS? Take a look at the issues and consistently you will find people having trouble rendering a complete site.
Creating a headless browser is really taking a real browser on Xvfb. You have the support of a billion dollar company supporting and updating their browser, you reap the benefits of being able to run it headlessly. The drawbacks of this method is often overstated, 'oh my run a fat browser process AND X display? ok grandpa' but the real hidden problem with PhantomJS is understated 'why does my phantomjs process balloon in memory and cpu usage and crash, I can render the website fine in my browser'.
Standalone headless browsers are good for hacks but I wouldn't rely on it.
One great use for headless is to separate non-UI framework/platform tests from UI tests - at my previous gig we wrote all the tests for the runtime platform against phantomjs to avoid the unneeded overhead of a full browser for things like data validation or mocking service calls, but used selenium to do the visual/interaction tests for the application UI itself. it's also a nice separation of concerns, though of course we hit all the same problems you mentioned as we were also pinned to 1.9.
1470 open issues
the first one is about phantomjs crashing and many many other scary sounding issues you wouldn't have if you've used just a regular browser with Xvfb.
you can't really be sure unless you've literally run a test on the colorful variety of websites in the wild. You need a huge development and quality assurance team. You also need a way for a large crowd of people to test your browser and send back useful reports automatically whenever it crashes.
Chrome: https://code.google.com/p/chromium/issues/list
73,025 open issues
Firefox: https://bugzilla.mozilla.org/buglist.cgi?bug_status=UNCONFIR...
10,000 open issues.
phantomjs is used mainly by developers. you can't seriously compare it to chrome or firefox.
quick scan shows that most of the bugs showing up in chrome and firefox are very platform centric or esoteric issues while phantomjs is concerning because they are literally about being unable to render a webpage without crashing.
That's a really weak argument. Here's 5000 Firefox bugs:
https://bugzilla.mozilla.org/buglist.cgi?component=General&product=Firefox&query_format=advanced&resolution=---&order=bug_status%2Cpriority%2Cassigned_to%2Cbug_id&limit=0It's 98% Ruby and is being called a "Unix tool" because it has cmdline options. Interesting criteria there.
It seems to be pitched as a js testing tool. Not clear on how it is different from node or just plain phantom.
If I needed to do something with JS as part of a series of Unix commands this would fit in the pipeline nicely. e.g. let's say someone wanted to do a one-off data transformation and they understand JS a lot better than Awk.