P
P
p3trukh1n2019-06-05 12:51:00
JavaScript
p3trukh1n, 2019-06-05 12:51:00

[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

1 answer(s)
G
GLaDosSystem, 2019-06-07
@GLaDosSystem

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 question

Ask a Question

731 491 924 answers to any question