![]() |
VOOZH | about |
Selenium is a tool for browser automation that supports multiple browsers for testing. With webdriver we can use multiple languages like Python,C#, and Java to write the code for automation testing. For Adding a Chrome extension in a browser with Selenium WebDriver allows us to automate the browser and an extension to it.
pip install selenium pyautoguiHere, we will use pyautogui to press buttons.
In the below code, we only need to provide the URL of an extension.
Output:
Steps to Add Chrome Extension
manifest.json
popup.html
popup.js
So this will easily load the extension and then we can use it according to our need.
Output:
While working with Selenium in chrome we generally have some common issue like Different version of Chrome and Chrome Driver. When we encounter such issue than it will throw error like "SessionNotCreatedException". Also sometime we come across the issues like not getting the element or not able to execute the operation on that element like we cannot send the keys to the button. But some of the common issue can be taken care by following the best practices which we should follow so that we don't encounter such problems while working with selenium.
Some best practices to follow while working with Selenium.
Using selenium with chrome we can do so many things. In selenium we have a webdriver which has been used for the automated testing of the website. Here we have used Selenium for adding chrome extension into the chrome. For this we have used python as a language and used pyautogui for clicking on the alerts which are been present in the process.