Chromeless: Add .html method

Created on 28 Jul 2017  路  4Comments  路  Source: prisma-archive/chromeless

Hello guys, thanks for sharing this project, it's awesome

Do you think could be more or less easy add an .html for output rendered HTML?

Example:

const html = await chromeless
    .goto('https://www.github.com')
    .wait(5) // ideally wait until HTML is ready
    .html()
API

Most helpful comment

@vladgolubev thanks for the response!

One thing I'm thinking all the time is, instead of wait an arbitrary quantity of time, could be possible wait until an DOM event is emitted?

Something like

const html = await chromeless
    .goto('https://www.github.com')
    .wait('DOMContentLoaded')
    .html()

All 4 comments

Just in case it may be useful until feature lands into master

const html = await chromeless
    .goto('https://www.github.com')
    .wait(5 * 1000)
    .evaluate(() => document.documentElement.outerHTML);

@vladgolubev thanks for the response!

One thing I'm thinking all the time is, instead of wait an arbitrary quantity of time, could be possible wait until an DOM event is emitted?

Something like

const html = await chromeless
    .goto('https://www.github.com')
    .wait('DOMContentLoaded')
    .html()

I implemented this in #112. I named it getHtml() to avoid confusion with setHtml().

EDIT: This has been renamed to html() in #143.

.html() Implemented in #112. Watch out for the current 128KB size limitation as noted in #114. Waiting for event to fire is being tracked in #98.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kellylawrence picture kellylawrence  路  4Comments

devfordays picture devfordays  路  3Comments

vanloc0301 picture vanloc0301  路  4Comments

georgejor picture georgejor  路  5Comments

mafshin picture mafshin  路  6Comments