casperjs

Can't require Underscore with CasperJS

老子叫甜甜 提交于 2019-12-01 05:32:08
问题 I'm using CasperJS to run automated frontend tests but have run in to an issue with using other npm modules in my tests. I'm aware of patchRequire however I believe that is only to be called outside of the test environment as the test runner patches require automatically. I did include it but the results were the same. It says it can't find the module. I have confirmed the underscore module is installed in node_modules in the projects root folder. Code 'use strict' _ = require 'underscore'

How to move jquery-ui slider with CasperJS

三世轮回 提交于 2019-12-01 05:20:51
问题 Is there any way to move the jQuery UI – Slider with CasperJS ? I also found this github issue while searching for a possibility to just click on the left or right of the slider to move the handle . But this doesn't worked for me as well. Any idea? 回答1: To move the slider works as follows: casper.mouse.down(100,100); casper.mouse.move(200,200); casper.mouse.up(200,200); with casper.capture('test1.jpg'); called before and after the three mouse lines you should see the differene. 回答2: This is a

Clicking a button to run casperJS in PHP and echo results in same PHP page with button

拟墨画扇 提交于 2019-12-01 04:11:14
问题 I have a casperJS script which logs in multiple users with provided credentials; which returns the amount successful and failed logins as well as the usernames which succeeded and failed. I am attempting to run this script by clicking a button within a PHP page, and after casperJS runs, I want the results to be echoed to the same page where the button was clicked (without reloading the page). I have looked at and reviewed the following Q/As but none of these provide an adequate answer to my

Casperjs iterating over a list of links using casper.each

非 Y 不嫁゛ 提交于 2019-12-01 03:55:26
I am trying to use Casperjs to get a list of links from a page, then open each of those links, and add to an array object a particular type of data from those pages. The problem I am having is with the loop that executes over each of the list items. First I get a listOfLinks from the original page. This part works and using length I can check that this list is populated. However, using the loop statement this.each as below, none of the console statements ever show up and casperjs appears to skip over this block. Replacing this.each with a standard for loop, the execution only gets part way

casperjs doesn't work as expected on windows machine

妖精的绣舞 提交于 2019-12-01 02:49:04
I have a casperjs script which gives the desired result when I run on a linux server, but when I run the same from my laptop, it doesn't work. How should I debug? Logs of the working one: [info] [phantom] Starting... [info] [phantom] Running suite: 3 steps [debug] [phantom] opening url: http://caspertest.grsrv.com/, HTTP GET [debug] [phantom] Navigation requested: url=http://caspertest.grsrv.com/, type=Other, willNavigate=true, isMainFrame=true [debug] [phantom] Navigation requested: url=https://caspertest.grsrv.com/my_app, type=Other, willNavigate=true, isMainFrame=true [debug] [phantom]

Python Subprocess returns non-zero exit status only in cron

前提是你 提交于 2019-12-01 02:46:54
问题 I have a Python script that manages a series of CasperJS tasks and processes the result. It runs well from the command line, but when I run the script in cron, I get the error: CalledProcessError: Command '['/path/to/casperjs', '/path/to/doSomething.js', 'args']' returned non-zero exit status 1 In Python, I call CasperJS: response = subprocess.check_output(['/path/to/casperjs', '/path/to/doSomething.js', 'args'], shell=True) I have tried shell=False and Popen as well, but I get the same

How to Login by filling the form in CasperJs

ⅰ亾dé卋堺 提交于 2019-12-01 02:31:08
Following is the hlml of the login form that I have <div class="login_area_user"> <form method="post" action="https://www.tradus.com/login?dest_url=https://www.tradus.com/cart/select-address" id="user-login"> <input type="hidden" value="1" name="form_submit"> <h3 style="display:inline-block;">Already a Member</h3> <p id="login-main-center-right-descp">You can use tradus login id and password</p> <div class="login-row"> <label class="colorBlack">Email / Login*</label> <input class="login-field" type="text" name="name" id="edit-namepopup"> </div> <!-- [/login-row] --> <div class="login-row">

CasperJs, how to repeat a step X times onWaitTimeout?

♀尐吖头ヾ 提交于 2019-12-01 01:51:42
So what I want to do is create a casperJS function which allows us to repeat a step X times, by refreshing the page first, when this step function reaches the timeout. For unreliable test due to a specific page bug/freeze at the moment and reduce the percentage of false negative. I have just a problem, I don't know how to break this loop, because I'm in IIFE scope, see following code : var echoTest = function(){ casper.echo('Hi'); }; var trueFunction = function(){ return true; }; var verifyFailedTest = function(number, trueReturn, thenFunction){ var i = 0; //outer: <------- for (; i <= number;

Message does not appear when called from evaluate method

烈酒焚心 提交于 2019-12-01 01:21:25
I'm new to casperjs and playing around with it, but I can't get its evaluate() functionality to work. This is my example var casper = require('casper').create(); casper.echo('started...'); casper.start('http://www.google.de/'); casper.then(function() { this.echo(this.getTitle()); }); casper.then(function() { this.evaluate(function() { this.echo('test'); }); }); casper.run(); I'm executing it with casperjs sample.js After started... and Google nothing happens in console output. The closure function given in the evaluate method is not executed. I don't even get further informations by console

Casperjs iterating over a list of links using casper.each

喜你入骨 提交于 2019-12-01 00:04:10
问题 I am trying to use Casperjs to get a list of links from a page, then open each of those links, and add to an array object a particular type of data from those pages. The problem I am having is with the loop that executes over each of the list items. First I get a listOfLinks from the original page. This part works and using length I can check that this list is populated. However, using the loop statement this.each as below, none of the console statements ever show up and casperjs appears to