Automate Chrome browser tasks using the Chrome DevTools Protocol and Node.js. This project provides a set of functions to fetch the installed Chrome browser version, download the corresponding ChromeDriver binary, set up the driver, create a new Chrome DevTools session, and open a website in the active session.
This project aims to simplify the process of automating Chrome browser tasks by providing a collection of functions built on top of the Chrome DevTools Protocol. It includes functionality to determine the installed Chrome browser version, download the appropriate ChromeDriver binary, and automate various browser actions.
Before using this project, ensure you have the following prerequisites installed:
- Node.js: Download Node.js
- Google Chrome browser
-
Clone the repository:
git clone https://github.com/PrantaDas/web-driver.git
-
Change to the project directory:
cd web-driver
-
Install dependencies:
npm install or yarn
Import the functions you need from the main.js
module and use them in your project. Make sure to handle errors appropriately.
const { getChromeVersion, downLoadDriver, saveZipFile, unzipFile, start, createSession, navigateToUrl, turnFullScreen, takeScreenShot, closeSession, getActiveElem } = require("./main");
(async () => {
try {
const version = await getChromeVersion();
console.log(version);
await downLoadDriver();
// Additional functions can be called here
} catch (e) {
console.log(e);
}
})();