Demonstration of:
- Selenium browser automation testing
- JavaScript programming language
- Node runtime built on Chrome's V8 JavaScript engine
- ChromeDriver extends Webdriver by adding Chromium-specific capabilities
Many more examples are here:
Install Node and NPM from https://nodejs.org/
Run this to confirm your version:
node -v
Output should be at least:
v23.6.1
Run this to confirm your version:
npm -v
Output should be at least:
11.2.0
Install Selenium WebDriver:
npm install --save selenium-webdriver@latest
Install Google chromedriver:
npm install --save chromedriver@latest
Run:
npm install npm@latest
npm upgrade
npm audit fix
Run:
./src/demo.js
If you prefer, you can run with Node explicitly:
node src/demo.js
The script will do three things:
-
Launch your local Chrome web browser to view the free open source testing examples web page https://testingexamples.github.io.
-
Interact with the web page in various ways, such as finding elements, clicking on elements, filling in form inputs, etc.
-
Print some typical HTML tag output that demonstrates the program is running successfully.
If you get this kind of error message:
“chromedriver” Not Opened. Apple could not verify “chromedriver”
is free of malware that may harm your Mac or compromise your privacy.
Or this kind of error message:
Apple is not able to verify that it is free from malware that could harm your
Mac or compromise your privacy. Don’t open this unless you are certain it is
from a trustworthy source.
Then click "Done".
Try this command line solution:
xattr -d com.apple.quarantine $(which chromedriver) 2>/dev/null
Try adjusting your system settings:
-
Apple menu -> Settings -> Security & Privacy -> General
-
See the entry that says: "chromedriver" was blocked to protect your Mac.
-
Click the button "Allow Anyway".
If you get this kind of error message:
UnhandledPromiseRejectionWarning:
SessionNotCreatedError: session not created:
This version of ChromeDriver only supports Chrome version …
Then you may need to harmonize your Chrome browser app and your Chrome webdriver.
If you use macOS brew, then upgrade chromedriver:
brew upgrade chromedriver
To update your Chrome browser app:
-
On your computer, open Chrome.
-
Find your current Chrome version by typing in the URL bar:
chrome://version/
. -
You should see a web page with many details, and you should see the first line with the version number, such as: "Google Chrome 135.0.7049.86 (Official Build)".
-
At top right, tap the "More" icon, which is 3 vertical dots.
-
You see the "More" menu. If you see a menu item "Update", then choose it. If you don't see a menu item "Update", then you're on the current version.
To update your Chrome webdriver:
-
Download the version that matches your Chrome browser app.
- Package: demo-selenium-javascript
- Version: 1.4.0
- Created: 2019-11-02T00:00:00Z
- Updated: 2025-04-24T13:58:02Z
- License: GPL-2.0-or-greater or for custom license contact us
- Contact: Joel Parker Henderson (joel@joelparkerhenderson.com)