What is the ideal location to install selenium-webdriver to work with NodeJS + Selenium + Mocha (On Windows) What is the ideal location to install selenium-webdriver to work with NodeJS + Selenium + Mocha (On Windows) selenium selenium

What is the ideal location to install selenium-webdriver to work with NodeJS + Selenium + Mocha (On Windows)


How can I know from which location of selenium-webdriver is Testcase getting executed

The package search location order of nodejs as below:

  1. project local packages, which at project_folder/node_modules
  2. nodejs global packages, which at NPM_global_package_install_folder/node_modules, you can get where is PM_global_package_install_folder by executing command:
    npm config get prefix it print out a folder path
  3. nodejs build-in module, which is inside node.exe

If your project local packages includes this package, nodejs will use it from local pacakges, otherwise use if from global package, if gloal packages not has this package, noejs will report module 'selenium-webdriver' not found error.

How can I remove/uninstall the additional selenium-webdriver installation completely

  1. In general, to uninstall project local package, execute npm uninstall selenium-webdriver under project folder, or npm uninstall selenium-webdriver -g to uninstall global package.

How can I generate some granular trace level logs to know whats happening within

Actually, selenium server supply a detail log of each selenium API call, not sure it's you wanted.
enter image description here


For nodejs program, each nodejs project can have a package.json which like pom.xml for java to manage the dependency. To init a package.json for a new project, just execute ' npm init ' under project folder in command line. then use the default value or change for each question, aftera all, a package.json file be created under project folder ( you can modify it anytime).

When install dependency of project, switch to the project folder, use ' npm install -S ' option -S means to append this package as depedency into package.json

Commit pakcage.json with auto script to code repo, when other person clone the repo to local, he just only need to execute ' npm install ' under the folder where package.json inside. he will get all dependency in package.json installed.

after npm install execute done. you will find a new folder: node_modules will under project folder, the node_modules folder is the place to store project dependency. The folder under node_modules named as package name is the pakcage installation path (Reminder don't commit node_modules folder to coder repo)

When script import a package/module via require(''), it will load the module from this node_modules folder, then parent folder unitl the root path, then nodejs globel package folder, then nodejs build-in module.

More detail you can find from : https://docs.npmjs.com/