Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inserting into a dialog with prompt? (Question) #687

Closed
td0m opened this issue Sep 5, 2017 · 3 comments
Closed

Inserting into a dialog with prompt? (Question) #687

td0m opened this issue Sep 5, 2017 · 3 comments

Comments

@td0m
Copy link

td0m commented Sep 5, 2017

Hey, I would like to insert some data into a JS prompt like this one. Is that possible with puppeteer?
Thanks 馃槑

@JoelEinbinder
Copy link
Collaborator

@aslushnikov
Copy link
Contributor

There's a snippet in the API: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-dialog

const puppeteer = require('puppeteer');

puppeteer.launch().then(async browser => {
  const page = await browser.newPage();
  page.on('dialog', async dialog => {
    console.log(dialog.message());
    await dialog.dismiss();
    browser.close();
  });
  page.evaluate(() => alert('1'));
});

@td0m
Copy link
Author

td0m commented Sep 6, 2017

@aslushnikov Thank you so much 馃槈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants