In this Puppeteer web automation repo, the following use cases have been covered:
- Automated testing of a form by navigating to a webpage.
- Controlling browser instances and pages for automated tests.
- Automated DOM manipulation and interaction with a webpage.
- Taking screenshots of a full page, a specific area, and generating a PDF of a webpage.
- Automated event handling on a web app.
- Automated testing using Puppeteer and Cloud Selenium Grid.
Step 1: Clone the repository in your local machine by using the following command in the terminal
git clone https://github.com/TheGreatBonnie/Puppeteer-web-automation-javascript.git
Step 2: Navigate to the root folder of the project and install all the dependencies using the following command
npm install
Step 3: Get the LambdaTest User Name and Access Key by navigating to LambdaTest Account Page. Then create an .env file in the root folder and add the LambdaTest User Name and Access Key to the file.
LT_USERNAME="Your username" LT_ACCESS_KEY="Your access key"
Step 4: Use the commands below to run the tests:
-
Automated testing of a form by navigating to a webpage
npm test formTest.test.js
-
Controlling browser instances and pages for automated tests
npm test pageNavigationFunctions.test.js
-
Automated DOM manipulation and interaction with a webpage.
npm test domManipulationFunctions.test.js
-
Taking screenshots of a full page, a specific area, and generating a PDF of a webpage.
npm test screenshotAndPdfFunctions.test.js
-
Automated event handling on a web app.
npm test eventHandlingFunctions.test.js
-
Automated testing using Puppeteer and Cloud Selenium Grid.
npm test main.test.js
Feel free to fork the repo and contribute to make it better! Email to thegreatbonniee@gmail.com for any queries or ping me on the following social media sites:
LinkedIn: @thegreatbonnie Twitter: @The_GreatBonnie