PhantomJS hangs for a long time saying “Asynchronous Sessions clean-up phase starting NOW”

Only semi-related answer i was able to find was the following: “The Asynchronous Sessions cleanup phase starting NOW … was caused by some calls to external feeds, these were intermittently slow. This phase must have been waiting for these calls, which were timing out, but PhantomJS sat there waiting for a very, very long time. … Read more

SVG images blocked by gmail proxy

I’ve heard back from Google support, and they’ve confirmed there are currently no plans to support SVG images in the proxy. They said they account for only 1 in 100,000 email images. Apart from PhantomJs, an option for simpler svg is the php plugin ImageMagick. Here’s some sample code to get you started: header(“Content-Type: image/png”); … Read more

How can I simulate a click event in my AngularJS directive test?

You can use triggerHandler, part of JQLite. I used this to trigger a click event on a directive… element = angular.element(“<div myDirective-on=’click’></div>”); compiled = $compile(element)($rootScope); compiled.triggerHandler(‘click’); Full example available on this blog post: http://sravi-kiran.blogspot.co.nz/2013/12/TriggeringEventsInAngularJsDirectiveTests.html

Why would a developer ever need PhantomJS as opposed to just using some testing framework?

JavaScript that requires a DOM needs someplace to run, normally in the browser. So test frameworks often fire up a browser which they then control in order to run the tests & carry out asserts. The test frameworks themselves often can’t control the browser directly, so you end up with three layers to your test: … Read more

How can I control PhantomJS to skip download some kind of resource?

UPDATED, Working! Since PhantomJS 1.9, the existing answer didn’t work. You must use this code: var webPage = require(‘webpage’); var page = webPage.create(); page.onResourceRequested = function(requestData, networkRequest) { var match = requestData.url.match(/wordfamily.js/g); if (match != null) { console.log(‘Request (#’ + requestData.id + ‘): ‘ + JSON.stringify(requestData)); networkRequest.cancel(); // or .abort() } }; If you use … Read more

How can I remove a whole IndexedDB database from JavaScript?

As far as I can tell, one should use indexedDB.deleteDatabase: var req = indexedDB.deleteDatabase(databaseName); req.onsuccess = function () { console.log(“Deleted database successfully”); }; req.onerror = function () { console.log(“Couldn’t delete database”); }; req.onblocked = function () { console.log(“Couldn’t delete database due to the operation being blocked”); }; I can confirm that it works with PhantomJS … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)