Closed OfficialCRUGG closed 2 years ago
await without async? very strange
Oh. In my code I have it in an async function. Just simplified it for the Issue and completely forgot about that.
.evaluate(() => { return document.querySelector("source").src; }) maybe?
I tried to run the duckduckgo code snippet from the readme:
const nightmare = new Nightmare({
show: true,
openDevTools: {
mode: 'right'
}
})
nightmare
.goto('https://duckduckgo.com')
.type('#search_form_input_homepage', 'github nightmare')
.click('#search_button_homepage')
.wait('#r1-0 a.result__a')
.evaluate(() => {
console.log('this is inside the browser')
return document.querySelector<HTMLLinkElement>('#r1-0 a.result__a')!.href
})
.wait(5000)
.end()
.then(console.log)
.catch(error => {
console.error('Search failed:', error)
})
The script output is always undefined
. Besides, the console.log
in the evaluate
function never print neither in the browser console (where it should according to the readme) or in my terminal.
Evaluate
function seems also broken for me.
Hey there. I am trying to do the following:
however it just returns "null" all the time. I even tried setting "show" to true for the Nightmare Instance and setting the wait to 10000ms and then tried to open the DevTools manually inside the Electron Window and it works in there. But after the 10 Seconds the Window closes and it still returns null. How can I fix this?
Edit: Output when running with Debug Flag: