Answer the question
In order to leave comments, you need to log in
[NightMare.js] How to get cookies and url together?
I am writing a small parser.
In one place there was a need to save the current URL and COOKIES.
Tried both the way you see below, and a little differently.
In each case, only .url or .cookies.get is passed to .then.
How to decide?
nightmare
.goto
.click
// ...
.cookies.get()
.url()
.end()
.then(console.log)
.catch(console.log)
Answer the question
In order to leave comments, you need to log in
Nightmare can be used with Async/await:
const n = nightmare.goto(...)
const cookies = await n.cookies.get()
const url = await n.url()
await n.end()
console.log(cookies, url)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question