phantomjs

Can't get phantomjs to work on aws lambda

蹲街弑〆低调 提交于 2019-11-30 15:49:23
I'm trying to execute phantomjs using node-lambda and bits and pieces I found on the web mainly https://github.com/justengland/phantom-lambda-template I had some problems deploying node-lambda with node43 but manually installing the latest source seems to have helped in that regard. but now I'm having trouble running the lambda functions. I get 2016-04-12T16:47:12.133Z 3330adb9-00ce-11e6-9c08-d79a6bc84748 Calling phantom: /var/task/phantomjs [ '/var/task/phantomjs-script.js' ] 2016-04-12T16:47:12.236Z 3330adb9-00ce-11e6-9c08-d79a6bc84748 Error: spawn EACCES at exports._errnoException (util.js

CasperJS File Download Times Out After 30 Seconds

牧云@^-^@ 提交于 2019-11-30 15:45:07
问题 I'm using CasperJS to download a 15 MB file. In the browser, the download takes about 3 minutes to complete. With Casper, the .download function for the same url returns after exactly 30 seconds, and the file written to disk is 0 bytes. I've tried setting longer timeouts like this: var casper = require("casper").create({ pageSettings: { webSecurityEnabled: false }, waitTimeout: 500000, stepTimeout: 500000 }); But they have no effect. Here's my download function: casper.on('resource.received',

Phantomjs: certain pages failing to open

大兔子大兔子 提交于 2019-11-30 15:13:56
问题 I am currently writing a web-application that involves some web-scraping. To help with this, I am employing the help of phantomjs. However, certain (but not all) web pages are returning a status="fail". Here is the code (note: This is actually written in nodejs using the node-phantom library found here: https://github.com/alexscheelmeyer/node-phantom. While the syntax may be different, the library actually works directly with phantomjs so it shouldn't be doing anything different: phantom

Paginating HTML document for printing with WebKit-based browsers

我只是一个虾纸丫 提交于 2019-11-30 15:09:51
问题 Internet Explorer has Print Template engine , where I can use DEVICERECT element to represent a physical page, then use LAYOUTRECT element as a rectangular view to flow the HTML document through into the page and drive the pagination. That prevents lines from being cut-off in the middle between adjacent pages. This mechanism is described in details here. Does WebKit provide a similar feature? Specifically, does PhantomJS do? I'm looking for anything that would allow to paginate an existing

Cannot find module 'casper' when invoking through PhantomJS

被刻印的时光 ゝ 提交于 2019-11-30 15:05:57
问题 I installed PhantomJS in C:\xampp\htdocs\phantom and also I installed CasperJS in this folder C:\xampp\htdocs\casper When I tried to run these sample code on casper site using phantomjs test.js command: var casper=require('casper').create(); casper.start('http://google.fr/'); casper.thenEvaluate(function(term) { document.querySelector('input[name="q"]').setAttribute('value', term); document.querySelector('form[name="f"]').submit(); }, 'CasperJS'); casper.then(function() { // Click on 1st

CasperJS File Download Times Out After 30 Seconds

与世无争的帅哥 提交于 2019-11-30 14:47:38
I'm using CasperJS to download a 15 MB file. In the browser, the download takes about 3 minutes to complete. With Casper, the .download function for the same url returns after exactly 30 seconds, and the file written to disk is 0 bytes. I've tried setting longer timeouts like this: var casper = require("casper").create({ pageSettings: { webSecurityEnabled: false }, waitTimeout: 500000, stepTimeout: 500000 }); But they have no effect. Here's my download function: casper.on('resource.received', function (resource) { var url, file; if ((resource.url.indexOf("myDownloadUniqueString=") !== -1) ) {

grunt-contrib-jasmine and PhantomJS security

孤街浪徒 提交于 2019-11-30 14:16:01
问题 I'm getting an error XMLHttpRequest cannot load https://my-api.domain.com. Origin file:// is not allowed by Access-Control-Allow-Origin. when I try to run some async unit tests that query an API through grunt-contrib-jasmine, which in turn using PhantomJS. I see that the command line version of PhantomJS does have a 'web-security' options. Can I control how grunt-contrib-jasmine uses PhantomJS to include this option and disable the cross-domain security? 回答1: You can pass options to phantomjs

How to get the HTML source of a website with PhantomJS

一个人想着一个人 提交于 2019-11-30 13:59:34
问题 Below is an example of PhantomJS that gets some element by DOM id from an external webpage: var page = require('webpage').create(); console.log('The default user agent is ' + page.settings.userAgent); page.settings.userAgent = 'SpecialAgent'; page.open('http://www.httpuseragent.org', function(status) { if (status !== 'success') { console.log('Unable to access network'); } else { var ua = page.evaluate(function() { return document.getElementById('myagent').textContent; }); console.log(ua); }

Cannot find module 'casper' when invoking through PhantomJS

老子叫甜甜 提交于 2019-11-30 13:57:36
I installed PhantomJS in C:\xampp\htdocs\phantom and also I installed CasperJS in this folder C:\xampp\htdocs\casper When I tried to run these sample code on casper site using phantomjs test.js command: var casper=require('casper').create(); casper.start('http://google.fr/'); casper.thenEvaluate(function(term) { document.querySelector('input[name="q"]').setAttribute('value', term); document.querySelector('form[name="f"]').submit(); }, 'CasperJS'); casper.then(function() { // Click on 1st result link this.click('h3.r a'); }); casper.then(function() { console.log('clicked ok, new location is ' +

Paginating HTML document for printing with WebKit-based browsers

余生颓废 提交于 2019-11-30 13:42:00
Internet Explorer has Print Template engine , where I can use DEVICERECT element to represent a physical page, then use LAYOUTRECT element as a rectangular view to flow the HTML document through into the page and drive the pagination. That prevents lines from being cut-off in the middle between adjacent pages. This mechanism is described in details here . Does WebKit provide a similar feature? Specifically, does PhantomJS do? I'm looking for anything that would allow to paginate an existing HTML document which doesn't have predefined page-breaks, and view it paginated as a new transformed HTML