Answer the question
In order to leave comments, you need to log in
Why is Nightmare.js not returning a result?
Hello.
I decided to master Nightmare.js for parsing dynamic content from sites.
I mostly work in php, from node.js to "you".
I installed nvm, node.js and nightmare.js itself, created the index.js file, tested the script, everything is fine.
From https://github.com/segmentio/nightmare took an example:
const Nightmare = require('nightmare')
const nightmare = Nightmare({ show: true })
nightmare
.goto('https://duckduckgo.com')
.type('#search_form_input_homepage', 'github nightmare')
.click('#search_button_homepage')
.wait('#r1-0 a.result__a')
.evaluate(() => document.querySelector('#r1-0 a.result__a').href)
.end()
.then(console.log)
.catch(error => {
console.error('Search failed:', error)
})
var Nightmare = require('nightmare');
var nightmare = Nightmare({ show: true });
console.log(nightmare);
Answer the question
In order to leave comments, you need to log in
This is the trouble with Linux, it is barely on the desktop, and you are on a laptop.
What is the laptop model? Does everything work in Live mode? Which of "all" distributions have you tried? Have you tried Fedora? What does it show airmon-ng
?
It turned out that Nightmare has outlived its usefulness, it does not work in node 8+ and with a fresh electron.
As an analogue, you can use puppeteer
Pay attention to the line with .then(console.log)
I assume that there should be something like this:
.then(res => console.log(res))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question