Greg Dougherty
Greg Dougherty

Reputation: 3471

Where is the config file for Protractor / webdriver-manager / Selenium?

I've installed Protractor and Selenium so I can do E2E testing with my JavaScript. When I launch Selenium (webdriver-manager start) I get the following line

10:20:17.961 INFO - Default driver org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match with current platform: MAC

How do I change the default driver? I see lots of references to config files, but I can not find any place where people give the name and location of the Selenium startup config file.

Upvotes: 1

Views: 6753

Answers (1)

Saifur
Saifur

Reputation: 16201

The place where you define the Selenium starup config file is

C:\Users\{user}\AppData\Roaming\npm\node_modules\protractor

See https://letmedothat.wordpress.com/category/protractor-2/

Summary of the linked blog page:

npm -version
npm install -g protractor
protractor --version
Java -version
webdriver-manager update
webdriver-manager start
cd C:\Users\{user}\AppData\Roaming\npm\node_modules\protractor\example
protractor conf.js

Updating driver is often necessary, running the selenium server, changing directory and then executing the test from command prompt is often boring and annoying. So, I wrote a simple batch file to make the process easy. Because, I am lazy. Simply copy these commands, change the file directory and save as .bat file. To execute the test simply double click and you are done.

@echo on
set errorlevel = 0
::WebDriver update
start /b webdriver-manager update
    If %errorlevel% neq 0 set "job=webdriver-manager update" exit/b &goto err
    ::exit/b 

::Start selenium  server
start /b webdriver-manager start
    If %errorlevel% neq 0 set "job=webdriver-manager start" exit/b &goto err

::Change directory
cd D:\Users\Saifur\AppData\Roaming\npm\node_modules\protractor\example
    If %errorlevel% neq 0 set "job=changing directory" exit/b &goto err

::Start running tests
protractor conf.js
    If %errorlevel% neq 0 set "job=protractor conf.js" exit/b &goto err

:err
    echo ERROR: %job% execution failed with error.

pause

Upvotes: 3

Related Questions