Testing with Protractor on Recent Chrome Versions
A comprehensive guide explaining how to resolve ChromeDriver compatibility issues when using Protractor with recent versions of Google Chrome, including detailed solutions and technical background.
Common Error
You might encounter this error when using Protractor with Chrome:
Overview of Key Components
To understand this issue, let's review the key components involved in running end-to-end tests with Protractor:
- Browser: Where the tests run
- Protractor: Reads test files and translates them to browser operations
- WebDriver: Intermediary driver following the W3C WebDriver Standard
- ChromeDriver: Chrome-specific implementation of WebDriver
Communication Routes
Protractor can communicate with the browser in three ways:
- Direct Communication
- Uses
directConnect: true
in Protractor configuration - Only works for Chrome and Firefox
- Uses
- Local Selenium Server
- Uses
seleniumServerJar
option - Or uses
seleniumAddress
with local instance
- Uses
- Remote Selenium Server
- Uses
seleniumAddress
with remote instance - Includes cloud-based platforms like BrowserStack or SauceLabs
- Uses
Why Is This Error Happening?
The error occurs because:
- The process for identifying and downloading ChromeDriver binaries changed for Chrome/ChromeDriver versions 115+
webdriver-manager
can no longer locate and download ChromeDriver versions newer than v114- This impacts Protractor when it relies on webdriver-manager
- Current stable Chrome version (at time of writing) is 126
How to Resolve the Issue
Solution Using chromedriver npm package
- Add chromedriver to devDependencies
- Configure Auto-Detection (Optional)
- Add to
.npmrc
:
- Add to
- Run npm install
Configuration Based on Your Setup
Case 1: Using directConnect or seleniumServerJar
Update your Protractor configuration:
Case 2: Using seleniumAddress with webdriver-manager
- Modify webdriver-manager update command
- Add npm script for Selenium Server
Note for Windows Users: The postinstall script removes the UNIX-based chromedriver executable to prevent Selenium Server confusion.
Key Points to Remember
- Ensure
node_modules/.bin/
is in your PATH when starting Selenium Server - Run npm install after adding new scripts
- The Windows-specific postinstall script is only needed for Case 2 setups
Troubleshooting Notes
If you're still experiencing issues:
- Verify all configuration changes are applied
- Check PATH environment variable
- Confirm correct versions of Node.js and npm
- Ensure proper permissions for file operations
- Check compatibility between ChromeDriver and Chrome versions