casperjs

Running casperjs tests with slimerjs

感情迁移 提交于 2020-01-24 12:42:28
问题 I wrote a few tests with casperjs. They run just fine with phantomjs. However, when I tried to use slimerjs with the following command: casperjs --verbose --engine=slimerjs test create-project-suite.js A small window appers with the SlimerJs logo and version number but the console seems to hang with the following line: Test file: create-project-suite.js Is there anything else I need to do? Here are the version numbers: Mozilla Firefox 28.0 CasperJS version 1.1.0-beta3 Innophi SlimerJS 0.9.1 3

Getting all table rows and returning them using an XPath query in CasperJS

Deadly 提交于 2020-01-23 10:39:09
问题 I'm using Casper.js to automate a regular upload. I've managed to upload the file and check if it's valid, but I'd like to parse the table which is returned if there's errors, but I get the error [error] [remote] findAll(): invalid selector provided "[object Object]":Error: SYNTAX_ERR: DOM Exception 12 . Here's the relevant part of my code: casper.then(function() { if (this.fetchText('.statusMessageContainer').match(/Sorry, the file did not pass validation. Please review the validation errors

Getting all table rows and returning them using an XPath query in CasperJS

∥☆過路亽.° 提交于 2020-01-23 10:39:07
问题 I'm using Casper.js to automate a regular upload. I've managed to upload the file and check if it's valid, but I'd like to parse the table which is returned if there's errors, but I get the error [error] [remote] findAll(): invalid selector provided "[object Object]":Error: SYNTAX_ERR: DOM Exception 12 . Here's the relevant part of my code: casper.then(function() { if (this.fetchText('.statusMessageContainer').match(/Sorry, the file did not pass validation. Please review the validation errors

Using casperjs and PHP to save data

两盒软妹~` 提交于 2020-01-23 04:24:07
问题 I've been looking for some kind of tutorial or example on how to do this, but either I'm not understanding that the solution is right under my nose, or no one has really put this out there. What I'm trying to do is use casperjs to automate a process where I create an account on a website. I will be providing a few different user names, and then I want to output a file at the end with the username that was used for registration along with the password. If I don't need to use PHP to do this,

CasperJS/PhantomJS .then in do/while Loop Doesn't Work

允我心安 提交于 2020-01-21 09:43:05
问题 Something like this seemed pretty logical to me but caused phantom to wtfcrash (That's what it's called in the log but doesn't give helpful info)... do { casper.then(function() { var targetFound = false; links = this.evaluate(getLinks); var searchResultsAr = []; for (var link in links) { searchResultsAr.push(links[link].replace('/url?q=', '').split('&sa=U')[0]); } for (var result in searchResultsAr) { if (searchResultsAr[result] == target) { targetFound = true; casper.echo(targetFound); break

casperjs --web-security=no --cookies-file=/tmp/mycookies.txt myscript.js did not working

老子叫甜甜 提交于 2020-01-16 08:30:51
问题 Hi for me the command did not working: $ casperjs --web-security=no --cookies-file=/tmp/mycookies.txt myscript.js (just copied from the documentation of casperjs: http://docs.casperjs.org/en/latest/cli.html#casperjs-native-options) I have created the cookie file from another script. Now I want to implement the cookies into the second script. But the above command did not work. What I want, is to implement the cookies before the first page invoke. And yes the cookies are still alive, bcause if

casperJS how to click multiple links in a table while collecting data from the web /.click() doesn't work?

a 夏天 提交于 2020-01-14 14:36:33
问题 I want to scrape some web data using CasperJS. The data is in a table, in each row there is a link leading to a page with more detail. In the script there is a loop iterating through all table rows. I want Casper to click the link, collect the data on a sub-page and come one history step back to process next table row. The problem is that the click() doesn't work and I don't know why. Is there any way to fix this ? (note: a javascript function viewContact is invoked by href) Here is the code

CasperJS: how to exit script execution?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-14 07:59:07
问题 Yesterday I've written my first tests with CasperJS and I find it amazing. The problem is that I couldn't find a way to exit the script execution (ie: casperjs doesn't exist so I can get back access to my console). I've found an workaround by adding a final test like so casper.test.begin('Exit', function suite(test) { casper.exit(); }); Regarding this technique I have 2 questions Is there a better way? How would that impact the output of the results to xunit file? 回答1: casper.then(function()

CasperJS/PhantomJS Segmentation fault

孤者浪人 提交于 2020-01-14 06:27:07
问题 I have a script which opens the urls in the links array and for each url it extracts the links in that url and inserts the new links to the array links(addLinks function). The code results in segmentation fault and it happens when it calls this.start to open a valid url (3rd line of the code). Is it a problem with casperjs or my code? Another interesting point is that it always prints 'OK, it is loaded' after the 'Page title: ' while according to the code they should be printed in reverse

Casperjs fill input without name

时间秒杀一切 提交于 2020-01-14 04:33:05
问题 i want to use facebook share dialog Link to share dialog with casperjs i managed to select the post mode "group" from the first dropdown , but i failed when i tired to fill the group name input (i think it use ajax drop down list) Screenshot of result with no luck , here is my code . var casper = require('casper').create({ pageSettings: { loadImages: false, loadPlugins: true, userAgent: 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0' }, logLevel: "info", verbose: