casperjs

Use a node module from casperjs

梦想与她 提交于 2019-11-26 09:56:42
问题 Is it possible to install a node module, installed via npm, and then require it from a casperjs script? (I see lots of posts and tools for running casper or phantom from inside node.js, but that is not what I\'m trying to do.) The casperjs docs seem to say it is possible, but only show with hand-written toy modules that don\'t really do anything. The real-world module I\'m trying to install is imap , but at this point I cannot get any module to work, even built-in ones like net . Simple

How to open a new tab in CasperJS

假如想象 提交于 2019-11-26 09:52:11
问题 I am using CasperJS testing framework to make some test suite since almost a month now, but I am facing a problem in one of them. Here is what I want to do: I am browsing a url (page1) and I have to make another action from an another url (simulate a new tab like we have on our graphics browser) without quitting the first one (page1). The action from the second url is going to change my first one. Hope it\'s clear enough :) So for now when I reach the step to observe that on my first url I

How do I access an iframe from CasperJS?

我们两清 提交于 2019-11-26 09:34:51
问题 I have a webpage with an iframe. I\'d like to access the contents of the iframe using CasperJS. In particular, I need to click buttons and fill a form. How can I do that? The main webpage is main.html: <html><body> <a id=\'main-a\' href=\"javascript:console.log(\'pressed main-a\');\">main-a</a> <iframe src=\"iframe.html\"></iframe> <a id=\'main-b\' href=\"javascript:console.log(\'pressed main-b\');\">main-b</a> </body></html> The iframe is: <html><body> <a id=\'iframe-c\' href=\"javascript

CasperJS passing data back to PHP

笑着哭i 提交于 2019-11-26 08:11:36
问题 CasperJS is being called by PHP using an exec() command. After CasperJS does its work such as retrieving parts of a webpage, how can the retrieved data be returned back to PHP? 回答1: You can redirect output from stdout to an array. On this page it says you can do: string exec ( string $command [, array &$output [, int &$return_var ]] ) It goes on to say: If the output argument is present, then the specified array will be filled with every line of output from the command. So basically you can

downloading a file that comes as an attachment in a POST request response in PhantomJs

徘徊边缘 提交于 2019-11-26 03:57:08
问题 I want to download a CSV file, it is generated on a button click through a POST request. I researched to my best on casperJs and phantomJS forums and returned empty handed. In a normal browser like firefox, a browser download dialog window appears after the post request. How to handle this case in PhantomJS TTP/1.1 200 OK Cache-Control: private Content-Type: text/html; charset=utf-8 Content-Encoding: gzip Vary: Accept-Encoding Server: Microsoft-IIS/7.5 Content-disposition: attachment;filename

CasperJS bind issue

*爱你&永不变心* 提交于 2019-11-26 03:44:10
问题 I\'m trying to reach an instagram page, but with no luck. I keep getting the error and a blank screenshot. Error text: TypeError: \'undefined\' is not a function (evaluating \'a.createDescriptor.bind(null,t)\') Casperjs --version is 1.1.0-beta3. Basically I use the following code: var casper = require(\'casper\').create({ verbose: true, logLevel: \'debug\', pageSettings: { userAgent: \'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94

How can I catch and process the data from the XHR responses using casperjs?

馋奶兔 提交于 2019-11-26 03:43:01
问题 The data on the webpage is displayed dynamically and it seems that checking for every change in the html and extracting the data is a very daunting task and also needs me to use very unreliable XPaths. So I would want to be able to extract the data from the XHR packets. I hope to be able to extract information from XHR packets as well as generate \'XHR\' packets to be sent to the server. The extracting information part is more important for me because the sending of information can be handled

Headless Browser and scraping - solutions [closed]

元气小坏坏 提交于 2019-11-26 00:49:16
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I\'m trying to put list of possible solutions for browser automatic tests suits and headless browser platforms capable of scraping. BROWSER TESTING / SCRAPING: Selenium - polyglot flagship in browser automation, bindings for Python, Ruby, JavaScript, C#, Haskell and more, IDE for Firefox (as an extension) for

CasperJS/PhantomJS doesn&#39;t load https page

ぃ、小莉子 提交于 2019-11-25 23:41:28
问题 I know there are certain web pages PhantomJS/CasperJS can\'t open, and I was wondering if this one was one of them: https://maizepages.umich.edu. CasperJS gives an error: PhantomJS failed to open page status=fail. I tried ignoring-ssl-errors and changing my user agent but I\'m not sure how to determine which ones to use. All I\'m doing right now is the basic casper setup with casper.start(url, function () { ... }) where url=https://maizepages.umich.edu ; 回答1: The problem may be related to the