phantomjs

define page evaluate outside of page open in phantomjs

隐身守侯 提交于 2019-12-10 19:27:12
问题 in the basic example of open a web page with phantomjs we use below code for open web and evaluate when page open complete in a function . var page = require('webpage').create(); page.open('http://www.sample.com', function() { page.includeJs("http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", function() { page.evaluate(function() { console.log(document.title); }); phantom.exit() }); }); is any way that let us define page.evaluate in a function out side of page.open callback

Set Screen size in PhantomJS/CasperJS

随声附和 提交于 2019-12-10 19:10:14
问题 I'm automating access to a web site to collect data from it. Unfortunately that page detects the screen size and doesn't give me the desired page if the screen is too small. When running the script from a non-interactive context (IIS web application) the Screen object seems to return a size of 1024x768 pixels. Even though I set the viewport size to 1300x1000 pixels which affects screenshots but not the web page's JavaScript. How can I tell PhantomJS or CasperJS (I'm using the latter but that

NodeJS server can't handle multiple users

好久不见. 提交于 2019-12-10 18:54:40
问题 I have a NodeJS server running on Heroku (free version). The server accepts a HTTP POST from a client (passing a parameter) and does a web request (using the parameter) in a headless browser. The headless browser is called HorsemanJS. "Horseman is a Node.js module that makes using PhantomJS a pleasure. It has a straight-forward chainable API, understandable control-flow, support for multiple tabs, and built-in jQuery." When I send a request (actually for loop of 20 requests) from a client (my

phantomjs-node crashes when attempting to scale behind node-cluster

你。 提交于 2019-12-10 18:35:32
问题 Associated GitHub issue: https://github.com/sgentle/phantomjs-node/issues/280 I have a simple app that does the following: var phantom = require('phantom'), express = require('express'), serve = express(); serve.get('/foo', function (req, res) { try { phantom.create(function (ph) { console.log('Phantom browser created w/ pid: ', ph.process.pid); ph.onError = function (msg, trace) { var msgStack = ['PHANTOM ERROR: ' + msg]; if (trace && trace.length) { msgStack.push('TRACE:'); trace.forEach

Run a Google App Engine on Travis-CI and test it with PhantomJS

放肆的年华 提交于 2019-12-10 18:14:22
问题 Is there a way to run a Google App Engine development appserver instance on Travis-CI, and then test that app with PhantomJS/CasperJS? One would not necessarily expect this to be a tremendously challenging thing, but I would be grateful for any relevant document, thoughts and suggestions. 回答1: This was discussed on Travis Github/issues, and in any case my solution has been to add this to .travis.yml : before_script: - wget https://googleappengine.googlecode.com/files/google_appengine_1.8.9

“IOError: [Errno 35] Resource temporarily unavailable” with PhantomJS, python, selenium, unittest

寵の児 提交于 2019-12-10 18:11:16
问题 I'm having an issue with running unit tests using selenium and the PhantomJS driver. It seems to be related to resource contention for stderr/stdout in the PhantomJS process. The error is: $ python -m unittest selenium_failure.SeleniumTestCase [] [{u'timestamp': 1395857498698, u'message': u'{"log":{"version":"1.2","creator":{"name":"PhantomJS","version":"1.9.7"},"pages":[{"startedDateTime":"2014-03-26T18:11:38.347Z","id":"https://www.google.com/","title":"Google","pageTimings":{"onLoad":294}}

Anyone successfully used jonnyw's “php phantomjs” with laravel, in a ubuntu envirement?

半世苍凉 提交于 2019-12-10 18:05:01
问题 Anyone sucessfully used jonnyw's "php phantomjs" with laravel, in a ubuntu envirement? I do not know if I am doing anything wrong, but I am questioning if it would be possible that it is not possible to use it with laravel in linux... I get all the time : "Error when executing PhantomJs procedure "default" - File does not exist or is not executable: bin/phantomjs" But I tried a lot of ways and many ways, but still didn't make it work...(I am "almost" "sure", that the file is in the right

CasperJS/PhantomJS chokes on loading a page

大城市里の小女人 提交于 2019-12-10 17:57:13
问题 I'm running the following script with phantomjs: var casper = require('casper').create(); var url = 'https://itunesconnect.apple.com/itc/static/login?view=1&path=%2FWebObjects%2FiTunesConnect.woa%3F' casper.on("page.error", function(msg, trace) { this.echo("Error: " + msg, "ERROR"); this.echo("file: " + trace[0].file, "WARNING"); this.echo("line: " + trace[0].line, "WARNING"); this.echo("function: " + trace[0]["function"], "WARNING"); errors.push(msg); }); casper.start(url, function(){ casper

Using PHP's exec() gives error: Fatal: [Errno 2] No such file or directory; did you install

有些话、适合烂在心里 提交于 2019-12-10 17:54:15
问题 I'm trying to use PHP to exec() a binary casperjs , exec('casperjs /var/www/mysite/application/phantomjs/test.js'); but I am getting the error Fatal: [Errno 2] No such file or directory; did you install phantomjs? CasperJS runs on top of PhantomJS, both which I manually installed and created a link at /usr/local/bin/phantomjs and /usr/local/bin/casperjs . So I am guessing casperjs calls phantomjs when it runs. However it works fine when I ssh into the server and run casperjs /var/www/mysite

Capture screen shot of lazy loaded page with Node.js

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 17:27:31
问题 I'm looking for a way to take a screenshot of a long web page every time it changes. I would like to use Node.js for this. My question is about how to render the full page with images and save it to disk ad an image file. Most images on the webpage is lazy loaded. So I guess that I need to scroll down the entire page first, before taking a screen shot. I tried different tools: casperjs node-webshot phantomjs All of them seems way too complicated, if not impossible, to even install. I didn't