casperjs

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

Testing broken html with casperjs

Deadly 提交于 2019-12-10 17:16:33
问题 I am trying to run some setup routines before running some CasperJs browser tests. At one point I am unable to fill in form data because there is some misplaced HTML (a form tag is misplaced in a table): <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Test</title> </head> <body> <table> <form id="test1"> <input type="text" name="selector_1" /> </form> </table> </body> </html> This is the simple test case: casper.test.begin('Test', 0, function suite(test) { casper.start('http:/

CasperJS : dropdown list; select an option, code works in browser&slimer but not with phantom

坚强是说给别人听的谎言 提交于 2019-12-10 15:59:24
问题 Here my problem : I'm in a specific case where I try to set the option of a select dropdown list. I usually use this.mouse.up() + this.mouse.down() but I can't in this case because this behavior doesn't work on the website with webkit (you can compare the two with google chrome and Firefox). Here the url : I want to set the field 'ANNEE' to a year, 2008 in my example My code : (my function changes the HTML and launches the change() event) //custom function casper.fillSelect = function

Why does CasperJS form submit not redirect to the next page?

半世苍凉 提交于 2019-12-10 14:24:11
问题 This is my first casper test, so I'm still struggling with the basics. I would like to fill in the username and password on my login form, then submit it. And then confirm if a 'log off' link is rendered on the next page (confirming that the user has been logged in). But as far as I can tell, when then is called, the url is still the same. Looks like no post or redirect to the next page is happening. What am I doing wrong? casper.start "http://test.local.mycompany.local/", -> @echo 'at ' +

Wait for URL change in Casper.js?

こ雲淡風輕ζ 提交于 2019-12-10 13:53:42
问题 There is a waitForUrl() functionality in Casper.js , but is it possible to waitForUrlChange() in Casper.js ? I mean detecting a change in this.getCurrentUrl() value. I can't predict the new url value. It can be anything. 回答1: Not built in, but you can write your own pretty easy: casper.waitForUrlChange = function(then, onTimeout, timeout){ var oldUrl; this.then(function(){ oldUrl = this.getCurrentUrl(); }).waitFor(function check(){ return oldUrl === this.getCurrentUrl(); }, then, onTimeout,

How do you Disable css in CasperJS?

ε祈祈猫儿з 提交于 2019-12-10 13:26:10
问题 I know how to disable images and plugins, but there doesn't seem to be an apparent option to disable css in CasperJS. Anyone knows how that works? 回答1: Assuming you want to suppress the loading of all external style sheets, you can do it by aborting requests to load css files, which is done by assigning a function to options.onResourceRequested: var casper = require('casper').create(); casper.options.onResourceRequested = function(C, requestData, request) { if ((/https?:\/\/.+?\.css/gi).test

How to click a button until the button isn't visible?

天涯浪子 提交于 2019-12-10 11:36:24
问题 I'm trying to write a step that clicks a more button until that button changes to display: none; . CLARIFICATION: The page I'm working with is a Google+ business page. There is a more button that loads about 10 reviews at a time until they are all loaded. Once they are, Google sets the button to display: none; I've played around with a ton of different ways to accomplish it. Right now I'm working with something like: This one is not working, and I'm sure there is an elegant way to accomplish

casperJS failed Injecting jQuery

旧巷老猫 提交于 2019-12-10 11:27:22
问题 Does anyone know how come I am encountering [warning] [phantom] Failed injecting %s client side. Failed injecting includes/jquery-1.10.2.min.js client side when I have included 'includes/jquery-1.10.2.min.js' within the Casper constructor. Someone posted a similar question here: https://groups.google.com/forum/#!msg/casperjs/hY4ziaoXIEE/YFi8Sj4JysMJ, but I do not understand how they have incorporated the casper.evaluate() in their solution: casper.then( function() { this.evaluate(function($)