ThePuppeteer Recorder feature in Chrome DevTools can monitor your webpage interactions and generate the code to automate a browser.
For example, if you click on an element and type an email address into an email field, the recorder can generate the following code:
await page.click("aria/Login");await page.type("aria/Email","umar.hansa@gmail.com");
Please note: Upon testing, there are a number of bugs with this feature, hence why it's experimental in Chrome Canary!
To get started, follow these instructions:
Cmd + Shift + P
).At this point, you can
Test generators can automatically write automation code based on your actions in a webpage. They're great, but just like with testing frameworks, they can have their own limitations. For example, they needsupervision - the code it generates is not your final test file, you'll still need to ensure:
waits
/pauses
are added if needed.That being said, the DevTools Recorder, and the recorders listed below in the "Extra" section, are extremely helpful for producingscaffolding-style code which would otherwise be tedious to write. Using it as a boilerplate for a new test file is worth doing.