casperjs

CasperJS cannot set window.navigator object

谁说胖子不能爱 提交于 2019-12-13 20:13:49
问题 Trying to scrape a web page with CasperJS. Webpage checks to see if the browser is an IE 6/7. Passing an userAgent with casperjs doesn't seem to satisfy its condition. UserAgent passed: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Following is the check being made by the page to determine the browser agt = navigator.userAgent.toLowerCase(); browserType = navigator.appName; if( ((browserType.indexOf("xplorer") != -1) && (agt.indexOf("msie 6.") != -1)) || ((browserType.indexOf("xplorer")

Unknown option when using CasperJS with “--ssl-protocol=tlsv1 --engine=slimerjs”

北慕城南 提交于 2019-12-13 19:30:37
问题 Every since the sslv3 POODLE bug came out I am unable to use casperjs with the "--engine=slimerjs" option. Before POODLE I was able to run my casperjs script like this: casperjs --engine=slimerjs script.js But after POODLE I needed to also send the "--ssl-protocol=tlsv1" to casperjs. This works without using the slimer option like this: casperjs --ssl-protocol=tlsv1 script.js Now if I want to use the slimerjs engine and send the ssl-protocol like this: casperjs --ssl-protocol=tlsv1 --engine

Trying to follow a link in an iframe using CasperJS

纵饮孤独 提交于 2019-12-13 17:07:37
问题 I'm trying to use CasperJS to follow a link that's in an iframe but I can't seem to get at the iframe's document. Here's a test using an iframe example page I found. The third iframe has a name attribute which I need for Casper's frame method. Casper API var casper = require('casper').create(); casper.start('http://nunzioweb.com/iframes-example.htm'); casper.withFrame('frame', function(){ this.echo('Page url is ' + this.getCurrentUrl()); this.echo(this.getHTML()); }); casper.run(); The page

CasperJS hangs out when accessing Google Keyword Planner

陌路散爱 提交于 2019-12-13 12:19:35
问题 My goal is to grab keywords from Google Keyword Planner, as the API does not support getting search volume in last 24 months but 12 months only. I use maily SimpleBrowser, so I am new with CasperJS, I googled some scripts, read documentation and then combined following script. I can login to Google, even to Adwords dashboard, but when I try to access KeywordPlanner CasperJS freezes, any idea? JS script /** * Basic vars * @type Module utils|Module utils */ var utils = require('utils'); var

Scroll down page event for x seconds

妖精的绣舞 提交于 2019-12-13 07:53:15
问题 I am currently able to scroll down a page with the help of CasperJS. I saw this article on how to scroll infinite pages based on the visibility of certain attributes. However I don't want to base it on the visibility of an element but was wondering if there is a way to set a timer on how long it should stay scrolling down before exiting out. How would be able to such thing? //function to scroll function tryAndScroll(casper) { casper.page.scrollPosition = { top: casper.page.scrollPosition["top

CasperJS: execute evaluate failed while the same code succeed in Chrome console

随声附和 提交于 2019-12-13 07:14:37
问题 The code: var array = casper.evaluate(function () { var nodes = document.querySelectorAll('#J_bought_main > div > div:nth-child(4) > div:nth-child(3) > div > div'); return Array.prototype.map.call(nodes, function extractOrder(x) { var textNode = x.querySelector('table:nth-child(2) > tbody > tr:nth-child(2) > td:nth-child(5) > div > p:nth-child(2)'); var urlNode = x.querySelector('table:nth-child(2) > tbody > tr:nth-child(2) > td:nth-child(6) > div > div:nth-child(2) > div:nth-child(1) > span

Install CasperJS from git

北战南征 提交于 2019-12-13 07:14:27
问题 From the docs, the process is: $ git clone git://github.com/n1k0/casperjs.git $ cd casperjs $ ln -sf `pwd`/bin/casperjs /usr/local/bin/casperjs After doing this, my error is as follows. What am I doing wrong? $ casperjs --version -bash: /usr/local/bin/casperjs: is a directory 来源: https://stackoverflow.com/questions/36094647/install-casperjs-from-git

Clicking an element using casperjs's evaluate function and jQuery

懵懂的女人 提交于 2019-12-13 04:47:08
问题 I am trying to use jQuery and casperjs to click an element retrieved from the DOM. casper.options.clientScripts = ["jquery-1.11.1.min.js"]; ... ... casper.then(function() { this.wait(2000,function() { this.evaluate(function() { var element = $('h4:contains("test")').prev().find('.delete'); $(element).css("background-color", "red"); $(element)[0].click(); }); }); )}; I have used $(element).css("background-color", "red"); to see exactly what element jquery is selecting, (I have used capture()

Cannot pass CasperJS result back to PHP

我们两清 提交于 2019-12-13 04:20:03
问题 This question was migrated from Software Engineering Stack Exchange because it can be answered on Stack Overflow. Migrated 5 years ago . I am trying to pass CasperJS results to PHP but it's not working (the output is empty). Here is my code: <?php exec("casperjs test.js", $array); print_r($array); ?> The exec works for any other command ("echo hello"), but not casperjs. $array is empty and execution time is instantaneous... The PHP script is of course in the same directory as test.js I'm

casperjs fill and click not working as i expected cannot click button

可紊 提交于 2019-12-13 03:51:51
问题 okay so i will post to sets of code below one the html form i am trying to use and submit and my casperjs code i am trying. the problem comes when trying to click the submit button i take a screenshot and get the resulting html but for some reason the html has no change at all and the screenshot shows the fields filled in but the form has not been submitted can someone help me heres the html <form action="userlogin.html" method="post" name="reg" id="reg" onsubmit="document.getElementById('sbt