nightmare

Javascript - Nightmare.JS infinite scroll action

谁说胖子不能爱 提交于 2019-12-11 12:58:08
问题 What am I doing wrong here? I want to scroll-down a page until the selector is gone. Nightmare.action('scrollPage', function (done) { this.evaluate_now(function () { var hitRockBottom = false; while (!hitRockBottom) { // console.log("1"); // Scroll the page (not sure if this is the best way to do so...) this.scrollTo(100000, 0); // Check if we've hit the bottom hitRockBottom = this.evaluate(function() { // console.log("0"); return this.exists('selector') === null; }); } }, done) }) I'm using:

Nightmare.js does not work with Azure webjob

五迷三道 提交于 2019-12-11 05:09:52
问题 I am trying to run an azure webjob which takes a json object and renders a webpage, then prints it to pdf, via the electron browser in Nightmare.js. When I run this locally it works perfectly, but when I run it in azure webjob it never completes. I get the two console.log statements output to the log, but seeing as I can not output anything from the nightmare.js calls, nor display the electron browser window, I have no idea what is going wrong. There is also a webserver in the script, omitted

NightmareJS screenshot callback

☆樱花仙子☆ 提交于 2019-12-11 02:09:50
问题 I'm using this framework to make screenshots of several urls. The process of taking the screenshot is async, and the method does not provide a way to execute a callback, and I want to execute a callback when each screenshot is made on this script: nightmare = new Nightmare(); urls.forEach(function (url) { nightmare.goto(url).screenshot(path); }); nightmare.run(function () { console.log('finished all'); }); Any ideas how can I do this? 回答1: I found a way to do this, with the "use" method for

Nightmare / Electron : Navigation Error (code - 118)

我与影子孤独终老i 提交于 2019-12-11 01:28:08
问题 Scraping with nightmare has been a breeze until recently , i started encountering errors with no details and the title "navigation error" and the error code 118 as shown below. { [Error: navigation error] '0': { message: 'navigation error', code: -118, details: '', url: 'http://markets.ft.com/research/Browse-Companies' }, length: 1, errors: [ { message: 'navigation error', code: -118, details: '', url: 'http://markets.ft.com/research/Browse-Companies' } ] } My nightmare code (Node.Js) :

NightmareJS multiple evaluations

谁说我不能喝 提交于 2019-12-09 18:06:35
问题 NightmareJS works great when I am running one evaluation, but as I interact with the page I need to do more evaluations as things pass. However using the docs I tried a simple sample of chaining evaluations and I get an error: describe('test google search results', function() { this.timeout(15000); it('should find the nightmare github link first', function(done) { var nightmare = Nightmare({show: true}) nightmare .goto('http://google.com') .wait(1000) .type('form[action*="/search"] [name=q]',

Nightmare.js screenshot buffer length 0

老子叫甜甜 提交于 2019-12-08 21:43:01
问题 I'm running a nightmare.js script where where I'm trying to take a screenshot of multiple elements on a page. The first element is captured just fine, but every other element that is below the fold is captured with a zero length. I am struggling to debug this issue. Any help would be incredibly appreciated. Basically this script walks through a page and selects all the elements on the page that match a selector. Then, using async it collects the responses and returns a buffer of objects. The

Cron and nightmarejs

我只是一个虾纸丫 提交于 2019-12-08 12:58:27
I can't manage to run my cron with nightmarejs. The first iteration of the function get_data() works great but after that the cron restarts and the function will not be triggered again. Also "crawl ended" is never logged. Do you know what's wrong with my code? Logs 1 cron data fetched 2 cron 3 cron - var Nightmare = require('nightmare') var nightmare = Nightmare({ typeInterval: 300, show: true, executionTimeout: 120000, gotoTimeout: 120000 }); let data = "" - var get_data = function(){ return new Promise(function(resolve, reject) { nightmare .goto('https://url.com') .type('[name=email]', '')

Handle multiple users requests to multiple remote web forms using PhantomJS

北慕城南 提交于 2019-12-08 06:56:37
问题 I created a ExpressJS application using NightmareJS which has a form and when we fill form and submit, it sends requests to some remote forms and calculate data and return those results. But the problem is it only works when single client submit the form. When multiple clients submit the form at same time it doesn't work. What could be the reason for this and how to solve this? Front end JS script $(document).ready(function () { $("#calculate-form").submit(function (event) { var request; if

Use Nightmare.js without ES6 syntax and yield

此生再无相见时 提交于 2019-12-04 11:54:54
问题 I built a simple node script using nightmare.js to scrape websites var Nightmare = require('nightmare'); var vo = require('vo'); vo(run)(function(err, result) { if (err) throw err; }); function *run() { var x = Date.now(); var nightmare = Nightmare(); var html = yield nightmare .goto('http://google.com') .evaluate(function() { return document.getElementsByTagName('html')[0].innerHTML; }); console.log("done in " + (Date.now()-x) + "ms"); console.log("result", html); yield nightmare.end(); } I

NightmareJS multiple evaluations

泪湿孤枕 提交于 2019-12-04 05:43:06
NightmareJS works great when I am running one evaluation, but as I interact with the page I need to do more evaluations as things pass. However using the docs I tried a simple sample of chaining evaluations and I get an error: describe('test google search results', function() { this.timeout(15000); it('should find the nightmare github link first', function(done) { var nightmare = Nightmare({show: true}) nightmare .goto('http://google.com') .wait(1000) .type('form[action*="/search"] [name=q]', 'github nightmare') .click('form[action*="/search"] [type=submit]') .wait(1000)//.wait('#rcnt')