casperjs

CasperJS is not working well on AngularJS

喜欢而已 提交于 2019-12-11 03:57:00
问题 If in casper, I only click on one button, then everything works fine. The following code passes the test. casper.then(function() { this.click('#loginB'); this.fill('#loginEmailField', { 'loginEmail': 'a@a.com', }, false); this.fill('#loginPasswordField', { 'loginPassword': 'a', }, false); this.click('#loginClickButton'); this.click('#logoutB'); test.assertNotVisible('#logoutB', "logout item should not show"); test.assertNotVisible('#loggedInItem', "loggedin item should not show"); test

xUnit with Jenkins: how to display colors in the Build Console Output?

早过忘川 提交于 2019-12-11 02:59:35
问题 I successfully setup CasperJS test suite exporting to an xUnit XML file that way: $ casperjs test googletesting.js --xunit=log.xml I managed to automate these tests through Jenkins thanks to the xUnit Plugin. I even managed to setup emails notifications when a build fails thanks to [Mail Watcher Plugin][3] which is great ! The only problem is the format of the output, it's a bit messy. In the build console output and in my email notifications I see the following: [37;46;1mTest file: tests.js

How can I reuse a variable populated within a casperJS call in a subsequent call?

梦想的初衷 提交于 2019-12-11 02:34:49
问题 I have the following scoping problem in a CasperJS script. baseTargetUrl is undefined when passing into casper.thenOpenAndEvaluate(). Why is this and how can I work around it? var baseTargetUrl; ..... casper.then(function() { baseTargetUrl = this.evaluate(function() { return __utils__.getElementByXPath('//*[@id="wrapper"]/div[1]/a[2]')["href"]; }); console.log('logging: '+baseTargetUrl); // works }); casper.thenOpenAndEvaluate(baseTargetUrl ,function() { //baseTargetUrl is undefined here var

CasperJS- Register on a site and validate the mail sent on Gmail -for both slimer and phantom-

≡放荡痞女 提交于 2019-12-11 01:56:25
问题 Edit : this is the windows behaviour, with linux it just fails. First, if you succeeded navigate on gmail with casper (without random waiting time -from 20sec to 5min-), please tell me. I want to register on our site, then validate my registration automatically with Gmail (an entire register step). Did someone do that before? I have no problem to register, and I can login on my mailbox (Gmail) but after i have some troubles to navigate and validate my registration in Gmail, and i observe

Cannot submit form with CasperJS - in other words cannot login

醉酒当歌 提交于 2019-12-11 01:50:03
问题 I'm trying to login into Tumblr with CasperJS using methods start , fill and waitForUrl but cannot do this. It seems to me that form wasn't submitted , because timeout in waitForUr expired everytime. Terminal response: Code I'm using is this: /*jslint browser: true, regexp: true */ // global casper, require var LOGIN_URL, LOGIN_USERNAME, LOGIN_PASSWORD, casper; casper = require('casper').create({ waitTimeout: 20000, viewportSize: { width: 1024, height: 768 }, verbose: true, logLevel: 'debug',

What's the best way to drive a browser headlessly on heroku for my purposes? [closed]

心已入冬 提交于 2019-12-11 00:23:03
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . Reworded completely: My vision: Web interface that takes email, student ID, password and desired class as parameters for heroku script. And then once a spot is open, use a webdriver on heroku to register them (using university student portal) and then email them the result

How to get get URL of new page using casperJS

让人想犯罪 __ 提交于 2019-12-11 00:20:11
问题 I am using casperJS to get links when clicking a button. The links are returned with window.open in javaScript. The code I have written logs all the pages after clicking button, but phantom is not exiting in terminal window. Also some pages only show about:blank, especially the last ones. var casper = require('casper').create(); var page = require('webpage').create(); var address = 'http://www.example.com'; page.open(address, function() { page.onPageCreated = function(newPage) { newPage

how to have a variable value for casper.repeat

血红的双手。 提交于 2019-12-10 20:38:09
问题 I want to repeat steps with CasperJS depending on a variable value coming from the page where I run CasperJS. To get this value, I do something like: casper.waitForSelector(".xxxx", function () { myvalue = this.evaluate(function() { value = Math.ceil(document.querySelector('#yyy').getAttribute('data-all')/10)-1; return value; }); }); Then I try to do something like: casper.repeat(myvalue, function() { but it doesn't work because repeat can't find myvalue variable. Any idea how to achieve

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

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