Skip to content

Instantly share code, notes, and snippets.

@kenshinji
Created December 8, 2017 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenshinji/685a70e929895419d66ad08d3b03cf1d to your computer and use it in GitHub Desktop.
Save kenshinji/685a70e929895419d66ad08d3b03cf1d to your computer and use it in GitHub Desktop.
const Nightmare = require('nightmare');
const nightmare = Nightmare({show:true});
//nightmare.useragent('Headless')
nightmare.cookies.set({
url: 'https://mastering-phoenix-framework-federicoesparza.c9users.io:8081/',
name: 'c9.live.user.click-through',
value: 'ok',
path: '/',
secure: true,
domain: '.mastering-phoenix-framework-federicoesparza.c9users.io',
expires: '2187-08-16T13:12:47.580Z'
})
.goto('https://mastering-phoenix-framework-federicoesparza.c9users.io:8081')
// .click('a.solid.fat.info.button')
// .wait('.App-title')
// .type("#yt_link", "http://yt.link")
// .click("input[name = 'Submit']")
// .wait(1000)
.click("#videos_page_link")
//.wait(1000)
// .goto('https://mastering-phoenix-framework-federicoesparza.c9users.io:8081/videos')
.evaluate(() =>
document.body.textContent
// document.querySelector('.App-title') # not working for some reason
)
.end()
.then((text) => {
console.log(text);
//expect(text).to.include('http://yt.link');
//done();
})
// .catch(done);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment