How to test Chrome extensions in Selenium
On This Page Why Use Chrome Driver to try a Chrome extension with Selenium?January 06, 2026 · 6 min read · Tool Comparison
With and Continuous Delivery (CD) becoming standard practices in, has been shew as a key portion in screen processes. are consciously and ceaselessly geared towards mechanization, with the aim of making testing faster, easier and more accurate. However, there are certain activeness that can be more difficult to automate. For example, automating the testing of browser extensions can pose difficulties. This article attempts to explore those difficulties and provide a few solutions. Before acquire into realize how you can test a Chrome extension employ Selenium, you should have an idea of what a ChromeDriver is and why it is required. ChromeDriver is a tool for enable automated test scripts to control the Google Chrome browser. It serves as a bridge between the Selenium WebDriver model and the Chrome browser. Since Selenium does not directly control browsers, it mail commands via a browser-specific driver. The ChromeDriver translates Selenium ’ s commands for Chrome to realize. Here are the steps that you can postdate to instal Chrome Driver Step 1: Check Your Google Chrome Version: Visit chrome: //settings/help and observe the version turn (e.g., 136.0.7103.48). Step 2: Download the Matching ChromeDriver: Visithttps: //chromedriver.chromium.org/downloads, select the version that matches your Chrome browser, and download the file for your operating system: Step 3: Extract the File: Unzip the download file to find the chase: Step 4: Move ChromeDriver to a System Path Folder For Windows: For macOS/Linux: Exposed Terminal and run: Step 5: Verify Installation: Open a end or command prompt to input: Once this is entered you ’ d see: With this, the Chrome Driver is all set to be used with Selenium. Read More: 1. Download Chrome Extension Get the webstore URL or extension ID from Google Web Store. Now enter the URL/ID into the main battlefield on this page:https: //chrome-extension-downloader.com/ Click Download. Save the CRX file. Store the file in the same location as your handwriting. Note: The CRX might be a local file that has not yet been uploaded to the Chrome Web Store. In causa the extension does not survive in the web shop, instal it manually by dragging the CRX file into theChrome: //extensionspage and clicking ‘ Add ’. Find more details on this operationhere. 2. Download theChrome Extension Source Viewerfrom the Google Web Store. 3. View source of the CRX file Go to the Chrome Extensions in the Google Web Store. Click the yellow icon in the browser. Go to View Source. If the CRX file is not displayed in the Web Store, the origin file can be viewed manually. Just clickhereand upload the CRX file. A tilt of all imagination (javascript, images, etc.) and pages available in the CRX should be displayed. 4. Identify the page to be try To locate a specific page, extract the unique ID of the CRX in the Chrome Extension. Here ’ s how. 5. Initiate Selenium script to create a new ChromeDriver Enter the Chrome Extension into ChromeDriver. is a standalone server that implements WebDriver ’ s wire protocol. To do this, new codification needs to be added to the beginning of the playscript when creating the browser object. Here ’ s the syntax for this codification in a number of languages much apply in scripts: Java For autonomous testing across multiple user personas, check out SUSATest — it explores your app like 10 different real users. Python Javascript PHPunit 6. Navigate to The ChromeDriver Website Page The syntax to do this is below: After doing this, the examiner can interact with and prove the extension as they would a normal HTML webpage. Often, an iFrame will be included in the HTML file. Switching the focus to the iFrame is easy, depicted in the examples below: PHPunit Python JavaScript Java Here, FRAME_NAME refers to Id, name,, and early. Learn more about. Browser extensions are embedded add-ons, not veritable HTML files. Since the extension is out of scope, it is not possible to simulate user activeness such as chink and ringlet, inspect web elements, etc. Normally websites can be easily tested by automatize user actions with. But in order to automate activeness on a browser extension, examiner have to identify where the extension ’ s pages are situate. Then, they would have to switch their scope in the web UI to interact with the extension pages as DOM elements. The steps delineate above enables testers to avoid that process and interact with an extension like they do with a normal HTML webpage. Thus, one can test a Chrome Selenium plugin withautomated Selenium testing. It is an simple process that just requires a few minutes of extra effort. In return, testing an important aspect of the website user experience get a simple task. Using tools like BrowserStack to test Chrome extension is a outstanding option. Here & # 8217; s why To summarize, for quiz Chrome propagation with Selenium, you will have to configure the browser to found with the extension enabled. This allows you to automate and verify its functionality across various scenario. This helps ensure your extension behaves as intended in. Methods, Classes, and Commands Configuration XPath Locators and Selectors Waits in Selenium Frameworks in Selenium Miscellaneous Best Practices, Tips and Tricks Design Patterns in Selenium: Page Object Model and Page Factory Action Class TestNG and Selenium JUnit and Selenium Use Cases Types of Testing with Selenium # Ask-and-Contributeabout this theme with our Discord community. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.How to try Chrome extensions in Selenium
Why Use Chrome Driver to test a Chrome extension with Selenium?
How to Set up Chrome Driver
sudo mv chromedriver /usr/local/bin/ sudo chmod +x /usr/local/bin/chromedriver
chromedriver -- version
ChromeDriver 123.0.6312.86
How to test a Chrome extension with Selenium?
Change options.html with the specific page on the unique URL. Example:
Change chrome-extension: //UNIQUEID/options.html to chrome-extension: //UNIQUEID/SPECIFICPAGE.htmlChromeOptions selection = new ChromeOptions (); options.addExtensions (new File (`` /path/to/extension.crx '')); DesiredCapabilities capabilities = new DesiredCapabilities (); capabilities.setCapability (ChromeOptions.CAPABILITY, selection); ChromeDriver driver = new ChromeDriver (capabilities);
chop = webdriver.ChromeOptions () chop.add_extension (EXTENSION_PATH) # create new Chrome driver object with Chrome propagation driver = webdriver.Chrome (chrome_options=chop)
var chromeOptions = webdriver.Capabilities.chrome (); chromeOptions: [binary: '/Applications/GoogleChrome.app/Contents/MacOS/Google Chrome ', args: [], extensions: ['EXTENSION_LOCATION.crx ']] var driver = new webdriver.Builder (). withCapabilities (chromeOptions). build ();
//Setting extensions is also optional $ options- & gt; addExtensions (array ('extension_location.crx ',)); $ cap = DesiredCapabilities: :chrome (); $ caps- & gt; setCapability (ChromeOptions: :CAPABILITY, $ options); $ driver = RemoteWebDriver: :create ($ url, $ caps);driver.get ('chrome-extension: //UNIQUEID/SPECIFICPAGE.html ');$ this- & gt; selectFrame (`` FRAME_NAME '');
driver.switch_to.frame (`` FRAME_NAME '');
driver.switchTo () .frame (`` FRAME_NAME '');
driver.switchTo () .frame (`` FRAME_NAME '');
Challenges of testing Browser Extensions
Why Use BrowserStack to Test Chrome Extensions?
Conclusion
Useful Resources for Automation Testing in Selenium
Related Guides
Automate This With SUSA
Test Your App Autonomously