Created
July 1, 2019 19:54
-
-
Save juliandescottes/b997ac00e81c27fcb15a03fbc6a6dee5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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