Installing PhantomJS on Mac
If you are using Homebrew, you can type: brew tap homebrew/cask brew cask install phantomjs
If you are using Homebrew, you can type: brew tap homebrew/cask brew cask install phantomjs
Found a way to do it and tried to adapt to your situation. I didn’t test the best way of finding the bottom of the page because I had a different context, but check the solution below. The thing here is that you have to wait a little for the page to load and javascript … Read more
RFC 2109 explicitly forbids cookie accepting from URLs with IP address You are almost certainly accessing your test server via an IP based address. You can try set up some kind of DNS/host file to allow you to use a fake domain name.
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
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
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
the output code you have is correct, but there is an issue with synchronicity. The output lines that you have are being executed before the page is done loading. You can tie into the onLoadFinished Callback to find out when that happens. See full code below. var page = new WebPage() var fs = require(‘fs’); … Read more
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
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
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