node-js-selenium-browserstack

prerequisite

Nodejs installed on your system
https://nodejs.org/en/

Steps

Step-1
Clone the repo, go to the cloned directory and install the dependencies with commands:

git clone https://github.com/browserstack/node-js-selenium-browserstack.git
cd node-js-selenium-browserstack
npm install 

Step-2
Configure the capabilities and swap your credentials.

  1. navigate to /conf.js
  2. Change the OS or browser if you want.
  3. Use your BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY from the dashboard.

Step-3
Run the test and see the session on the browserstack dashboard.
Follow step-2 then,

To run a test session:

npm run parallel

To run a local test session: also provide the access key to bs_local_args

// replace <browserstack-accesskey> with your key.
var bs_local_args = { 'key': ACCESS_KEY };
npm run local