casperjs

Returning links inside iframe using a function in CasperJS

核能气质少年 提交于 2019-12-13 02:26:16
问题 I am trying to get the links from inside an iframe and return them as a function result, my simplified code looks something like this: var casper = require("casper").create({ verbose: true, logLevel: "debug", webSecurityEnabled: false }); var url = casper.cli.get(0); casper.on('remote.message', function(msg) { this.echo(msg); }) casper.start(url, function () { thelinks = getLinksFromIframes( casper ); console.log("doesn't work:" + thelinks); }); function getLinksFromIframes( context ) { var

How can I pause and wait for user input with Puppeteer?

人盡茶涼 提交于 2019-12-12 18:31:07
问题 I need to make Puppeteer pause and wait for user input of username and password before continuing. It is a nodejs 8.12.0 app. (async () => { const browser = await puppeteer.launch({headless: false}); const page = await browser.newPage(); await page.goto('https://www.myweb.com/login/'); //code to wait for user to enter username and password, and click `login` const first_page = await page.content(); //do something await browser.close(); )}(); Basically the program is halted and waits until the

PhantomJS/CasperJS AssertExists() is failing

≡放荡痞女 提交于 2019-12-12 16:44:05
问题 I am trying to check wether a selector exists in my webpage but casperjs never finds it. I've tried two approaches: 1. Without waiting casper.then(function() { // search for 'casperjs' from google form this.test.assertExists('#search-form', 'the element exists'); // this.test.assertExists('.glyphicon.glyphicon-plus', 'the element exists'); }); 2. Waiting for selector casper.waitForSelector('#search-form', function() { this.echo("I'm sure #search-form is available in the DOM"); }); 3. Another

CasperJS seems unable to recognise password field on login form

别来无恙 提交于 2019-12-12 16:40:51
问题 I'm brand new to CasperJS and coffeescript. I have a very simple part of my CasperJS coffeescript test to login to a website, that used to work before a recent change to the password element of the login form. Unfortunately I can't remember the original form but here's how the current login form looks: <div id="login-body"> <img src="/assets/images/logo.png" class="logo" alt="Test Acme Wil-e-Coyote Company"> <form action="/Login/login/" method="post"> <h2>Please log in to catch the roadrunner

Catch and Handle CasperError

ε祈祈猫儿з 提交于 2019-12-12 11:07:14
问题 Using CasperJS how do I catch and handle CasperError? The default appears to continue execution of the program (which does nothing but propagates the error). These errors are logged to the console/stdout but I don't seem to see a way (from the docs) to catch and handle these errors. Example: this.fillSelectors(selector, data); May produce: CasperError: Errors encountered while filling form: form not found I know I can check to make sure everything exists before calling, but is there a way to

casperjs doesn't work as expected on windows machine

ぃ、小莉子 提交于 2019-12-12 07:26:23
问题 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

Impossible to .sendKeys(..) with CasperJS on some sites

大憨熊 提交于 2019-12-12 05:46:33
问题 I am loosing my mind over trying to do something inherently seemingly banal, but it seems almost hopeless. For a thesis project I need to collect flight prices. This code should just fill in "zurich" to the departure box. But it doesn't. This code works normally with any text imput box, but on this simple page its hopeless. I really would appreciate someones wisdom here: // variables var casper = require("casper").create(); var x = require('casper').selectXPath; var url = 'http://www

Casperjs Google Login Not working

眉间皱痕 提交于 2019-12-12 05:16:27
问题 I having been working on some code to access my google finance portfolio, but the problem is I need to sign in with my google account. So i have made this: var casper = require('casper').create(); casper.start('https://accounts.google.com/Login?hl=EN', function() { this.evaluate(function(username, password) { this.echo(this.getTitle()); document.querySelector('input#Email').value = username; document.querySelector('#next').click(); document.querySelector('input#Passwd').value = password;

Why Casperjs can only load half page of Outlook.com? Images included

旧街凉风 提交于 2019-12-12 05:14:51
问题 is there any one know what kind of problem is that? should i add any path to support casperjs? any solution to make it displayable? thanks for your help. Click here for picture: First picture is using casperjs, which cant load like a regular browser 来源: https://stackoverflow.com/questions/35670589/why-casperjs-can-only-load-half-page-of-outlook-com-images-included

casperjs: how do I click a remote div and then update it's class name?

前提是你 提交于 2019-12-12 04:45:45
问题 As a way of learning CasperJS, I am trying to initiate a click event on a div on a remote page, and then change the class name of the div after I have clicked it. The idea is to find the first clickable div, click it, and then mark it as clicked so I can skip over it to other clickable divs. The markup for the div tag on the remote page looks like: <div class='clickable_div'></div> I have tried the following casperjs code: ... casper.then(function() { if( this.exists( 'div.clickable_div' ) )