Get tables’ columns’ text with WebdriverIO.
- First, you’ll need the selenium standalone server. Make sure you have the
JDK (try running
javac -versionto see if you have it.) Then, follow steps 2 and 3 on WebdriverIO’s Getting Started guide. Version 2.45.0 is the latest at the time of writing. If the guide suggests a new version you will need to update the.jarfile reference in package.json. - Install dependencies with
npm install. - Make sure you have Firefox as
WebdriverIO uses it by default. (You can change this via the
optionsvariable at the top of test.js.)
This project uses http-server to serve up its index.html file. test.js uses WebdriverIO to examine this file. Here’s how to fire up selenium and the server:
- Run
npm run serveto fire up the local server. You can navigate to localhost:8080 and see the file. - Run
npm startin another terminal tab/window to fire up the selenium server.
You’re now ready to run the tests! In yet another terminal tab/window, run npm test. This will output test results in the terminal.
The code in test.js contains extensive comments. Go read it!