Skip to content
This repository has been archived by the owner on Jul 8, 2023. It is now read-only.

implement events #1

Open
deepsweet opened this issue Aug 9, 2018 · 1 comment
Open

implement events #1

deepsweet opened this issue Aug 9, 2018 · 1 comment
Assignees
Labels
enhancement New feature or request on hold

Comments

@deepsweet
Copy link
Owner

https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#class-page

page.on('close') and so on.

@deepsweet deepsweet added the enhancement New feature or request label Aug 9, 2018
@deepsweet deepsweet self-assigned this Aug 9, 2018
@deepsweet
Copy link
Owner Author

So...

There is no (simple) way to have a non-blocking events like in Puppeteer:

const page = await browser.newPage()

page.on('console', msg => console.log(msg.text()));

await page.evaluate(async () => { console.log('hi') })
await browser.close()

because Marionette uses a classic asynchronous transport model: sends message with an ID and then asynchronously gets a response using the same ID.

Options I see:

  1. Something like blocking getLog in Nightwatch with an initial global hook:
const page = await browser.newPage()

await page.evaluate(async () => { console.log('hi') })

console.log(await page.getLog())

await browser.close()
  1. Introduce a second layer of real-time communications between page and Foxr using an injected WebSocket. Not sure if Puppeteer has been using the same or there is a direct way to do that in Chrome Debugging Protocol.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request on hold
Projects
None yet
Development

No branches or pull requests

1 participant