These are chat archives for rosshinkley/nightmare

5th
Jul 2016
Mingsterism
@mingsterism
Jul 05 2016 14:51
@rosshinkley hey ross .why doesnt this code work. It appears the inner function fn does not have access to the outer scope as error is document is not defined
BaseBot.prototype.titles = function() {
    const t = Array.prototype.slice.call(document.querySelectorAll('.M-0 .Pt-2'))    
    var fn = () => {t.map((x) => {return x.innerText})}
    return fn

const bot1 = new BaseBot('james')
bot1.nightmare
    .goto('http://finance.yahoo.com/')
    .evaluate(bot1.titles())
    .then((x) => {
        console.log(x)
    }, (err) => {console.error(err)})