casperjs

rails controller returning nil response while running casperjs test cases with shell script

给你一囗甜甜゛ 提交于 2019-12-11 11:15:46
问题 I am using casper test cases with a rails application, for running the test case I am using following command. result = `cd #{Rails.root.join}/casper && casperjs test #{params[:file]}.js` The above mentioned code is working fine on development environment(webrick) but if I run this on staging(nginx+passenger) then I am getting nil response within seconds that means that the script is running asynchronously, I need to run this synchronously so that I can send a JSON response to the client. the

CasperJS how to handle malformed HTML?

吃可爱长大的小学妹 提交于 2019-12-11 10:45:57
问题 i need to upload a file to a customer site automatically, the site is protected by login credentials. Now I've a really big problem because the login page (and probably the rest of the site..) have a malformed HTML. How can i handle this pages? seem that casperJS not be able to handle the malformed HTML Malformed HTML EXAMPLE (this is the site page cleaned up a bit but with original problems like tr or td not closed and so on..): <html> <head> <title>TEST Login Page</title> </head> <body>

Casperjs Not returning Google Search link titles BUT Screenshot & Source Code test works

你说的曾经没有我的故事 提交于 2019-12-11 10:27:42
问题 Appreciate someone can help me with this problem I'm having. Please see my image to understand further. https://onedrive.live.com/redir?resid=F95DD828CA2E63D7!1326&authkey=!AEbavlKl38fBJYI&v=3&ithint=photo%2cjpg I have a screenshot of the actual CasperJS html capture. It shows that casperjs correctly entered the field in google. The problem is CasperJS not calling my function getLinks >> links = this.evaluate(getLinks);. >> it returns null. I have tested the actual selector >>

Can't get login with casperjs to work

对着背影说爱祢 提交于 2019-12-11 09:47:31
问题 I scrapped the page https://www.wikifolio.com/de/de/home for a while now with casperjs. Recently it takes a login to see the information on the page and I just can't get it to work. I can't seem to find which item I have to click to get rid of the disclaimer and later to log into the site. 回答1: It's possible with 2 different ways, this will work: var casper = require('casper').create({ verbose: true, logLevel: 'debug', waitTimeout: 5000, userAgent: 'Mozilla/5.0 (X11; Linux x86_64; rv:49.0)

CasperJS : how to call __doPostBack

混江龙づ霸主 提交于 2019-12-11 08:26:03
问题 I am trying to scrap a page : http://fd1-www.leclercdrive.fr/057701/courses/pgeWMEL009_Courses.aspx#RS284323 But as you can see this link redirect to fd1-www.leclercdrive.fr/057701/courses/pgeWMEL009_Courses.aspx when you first access it. after you click on "fruits et légumes" you can access the page using the url directly So I need to simulate a click on the button "Fruits et légumes" to access the page I want. In the code, it does a dopostback Here is my code that I use with casperj s : var

Returning links inside multiple-levels iframe using a function in CasperJS

故事扮演 提交于 2019-12-11 07:34:59
问题 I am trying to get all links under multiple level iframes in CasperJS. There was a solution to resolve the case that there is one-level iframe. I am trying to put getLinksFromIFrame inside the getLinksFromIfram to do recurive traverse but failed. For this code, how should I do it for multiple-level iframes? function getLinksFromIframes( callback ) { var links = []; var iframes = this.evaluate( function() { var iframes = []; [].forEach.call(document.querySelectorAll("iframe"), function(iframe,

How do scrape table from the provided website using casperjs?

此生再无相见时 提交于 2019-12-11 06:07:46
问题 The final goal is to retrieve stock data in table form from provided broker website and save it to some text file. Here is the code, that I managed to compile so far by reading few tutorials: var casper = require("casper").create(); var url = 'https://iqoption.com/en/historical-financial-quotes?active_id=1&tz_offset=60&date=2016-12-19-21-59'; var terminate = function() { this.echo("Exiting ...").exit(); }; var processPage = function() { var rows = document.querySelectorAll('#mCSB_3_container

cant get CasperJS to work on Mac OSX

孤者浪人 提交于 2019-12-11 05:53:34
问题 Tried almost everything, ending up with removing all npm&node (and node modules) and installing again. same results: CasperError: Can't find module fs phantomjs://code/bootstrap.js:297 in patchedRequire phantomjs://platform/colorizer.js:35 CasperError: Can't find module fs phantomjs://code/bootstrap.js:297 in patchedRequire phantomjs://platform/casper.js:36 TypeError: undefined is not a constructor (evaluating 'require('casper').create()') phantomjs://code/cloner.js:1 in global code :0 in

Script is timing out and not finding selector

旧街凉风 提交于 2019-12-11 05:08:36
问题 I'm trying to load this page: https://login.morganstanleyclientserv.com/ My current code: var casper = require('casper').create(); var x = require('casper').selectXPath; var userName = 'xxxxxx'; var Password = 'xxxxxx'; casper.userAgent('Mozilla/4.0 (comptible; MSIE 6.0; Windows NT5.1)'); casper.start('https://login.morganstanleyclientserv.com/') casper.then(function () { this.sendKeys('#txtUsername', userName); console.log('Entering Username'); }); casper.then(function() { this.sendKeys('

casperJS page.resource.request and page.resource.response callback calls increment when opening multiple URL

北城以北 提交于 2019-12-11 04:00:26
问题 I've got a small problem which has to do with the following approach: I want to iterate through a given array of URLs with a loop I do this here because I want to measure the loading time of each page which is listed in the URL List Here comes the code which is leaned to this example here (https://stackoverflow.com/a/24137013/4353553): var urls = [ 'meine-url.de/home.html', 'meine-url.de/impressum.html', 'meine-url.de/rechtliche_hinweise.html', 'meine-url.de/datenschutz.html', 'meine-url.de