10 Interesting updates in PhantomJS 1.7
Last week, PhantomJS got an update and you can check out the release notes to see the improvements. I definitly like the generic module update and better cookie handling. Better support for mouse and keyboard related events are also great. But, I am also really looking forward to some of the other features and improvements. These are my top 10:
- Mouse Events: Left-click, Right-Click, Middle-Click and Double-Click
- Keyboard Events: keyup, keydown, and keypress (sends one character or sequence of characters)
- Pageref attribute was added to HAR netsniff.js example and end-time
- Support for page closing: now we have a “page.close()” and “page.onClosing = function(page){}” callback.
- Support for current page url, current frame url, current frame HTML content, and current frame content in Plain Text
- Redesign of the Cookies API: NEW METHODS page.addCookie({cookie}), page.deleteCookie(name), page.clearCookies(), and phantom.cookiesEnabled = boolean
- Module system support for generic modules
- Support for Window Popups: finally you can properly handle popups with Phantom.
- Fixed font antialiasing on Windows
- Fixed rendering of ICO images on Windows
Also, I should add that updating PhantomJS to the latest is really easy if you installed it via brew on Mac OSX. I just ran brew upgrade PhantomJS and it automatically updated Phantom from 1.5 to 1.7. Then I did a git pull for the examples directory. My netsniff.js example is now enhanced and the pages object has an onLoad timing under pageTimings. Now, I am just waiting for feature 230 to be implemented: Ability to prevent resources from being loaded.
Update:
It looks like feature 230 was implemented and now you can request.abort which is awesome!