Selenium is a tool that helps us automate anything present on the web. Breaking this definition down to even simpler terms than selenium provides us the ability to interact with the web browser automatically using codes. From login to a website to like, share, or comment on a post we can do it all automatically with the help of selenium. So if you are thinking that you will write a code and once you run that code things will automatically get done on the web, then “yes” you are correct, with the help of selenium we can control the actions automatically that we do on the web.
If you want to explore more about the interesting basic concepts of selenium then please give basics of selenium article a read.
Step 1. Install Node
Step 2. Create package.json File
After having a node in our system now we need to initialize the project by creating a package.json file and for doing this we will open a terminal in the location where we are running the project and then will provide the following command.
Step 3. Install Selenium Webdriver
Now we have to install selenium-webdriver package and for doing this we simply have to run the following command.
npm install selenium-webdriver
Step 4. Install Driver For Browser
npm install chromedriver
If you want to run automation in a different browser then you can install webdriver of that particle browser.
Step 5. Testing simple code:
Step 6. Running the code:
In order to run the code we can simply use the normal method of running a node file and that is the following