Skip to content

Instantly share code, notes, and snippets.

@juliandescottes
Created July 1, 2019 19:54
Show Gist options
  • Save juliandescottes/b997ac00e81c27fcb15a03fbc6a6dee5 to your computer and use it in GitHub Desktop.
Save juliandescottes/b997ac00e81c27fcb15a03fbc6a6dee5 to your computer and use it in GitHub Desktop.
(async() => {
const browser = await startPuppeteerBrowser(process.argv);
console.log('Create page');
const page = await browser.newPage();
console.log('Go to https://rounded-haze.glitch.me/');
await page.goto('https://rounded-haze.glitch.me/');
console.log('Wait for 1 second');
await new Promise(r => setTimeout(r, 1000));
const text = 'Some longer text that is a bit long';
for (let i = 0 ; i < 500 ; i++) {
await page.type('input', text);
const inputValue = await page.evaluate(() => document.querySelector('input').value);
await page.evaluate(() => document.querySelector('input').value = '');
if (inputValue != text) {
throw new Error('Wrong value: ' + inputValue);
}
}
console.log('Close the browser');
await browser.close();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment