Acsah mathew
Acsah mathew

Reputation: 1

getting an error on trying to launch Chrome using Protractor

I'm trying to launch the browser through Protractor. I downloaded webdriver through terminal by giving webdriver-manager update command. This is downloading the latest chromedriver v74, but the chrome browser is v73.

How to explicitly set the WebDriver version?

I'm getting the following error:

[11:09:13] E/driverProvider - Error code: 135
[11:09:13] E/driverProvider - Error message: session not created: This version of ChromeDriver only supports Chrome version 74
[11:09:13] E/driverProvider - Error: session not created: This version of ChromeDriver only supports Chrome version 74
  (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Mac OS X 10.14.2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.70 seconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'Acsahs-MBP', ip: 'fe80:0:0:0:45:3f89:2e8b:ab96%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.2', java.version: '1.8.0_191'
Driver info: driver.version: unknown
    at Local.<anonymous> (/usr/local/lib/node_modules/protractor/built/driverProviders/driverProvider.js:69:23)
    at Generator.throw (<anonymous>)
    at rejected (/usr/local/lib/node_modules/protractor/built/driverProviders/driverProvider.js:5:65)
    at processTicksAndRejections (internal/process/next_tick.js:81:5)
[11:09:13] E/launcher - Process exited with error code 135

My config file:

exports.config = {
    seleniumaddress:'http://localhost:4444/wd/hub',
    specs:['spec.js']
};

Upvotes: 0

Views: 1504

Answers (3)

ireshika piyumalie
ireshika piyumalie

Reputation: 2402

Add this as a script to your package.json file

"scripts": { "protactorInstall": "cd ./node_modules/protractor && npm i webdriver-manager@latest"}

use

npm run protactorInstall

to execute the script.

Upvotes: 1

suryavansh
suryavansh

Reputation: 191

is it solved yet? if not then try this.

for my small selenium-webdriver test i did these steps after i researched online and here:

  1. npm install selenium-webdriver
  2. npm install chromedriver
  3. npm install geckodriver and opened file library.js and npm init and ran node library.js (source code below)
  4. Error: (node:14212) UnhandledPromiseRejectionWarning: NoSuchSessionError: invalid session id Some long error related to not same chromedriver version. so i checked the chrome browser version manually in the browser. it was version 73 and my mistake i had downloaded chromedriver version 74.0.
  5. so go to https://chromedriver.storage.googleapis.com/index.html?path=73.0.3683.68/ download according to your OS and download it in ~/Downloads .
  6. then in open terminal in the ~/Downloads folder.
  7. then USER@DESKTOP:~/Downloads$ unzip ~/Downloads/chromedriver_linux64.zip -d ~/Downloads You will get the raw chromedriver file in ~/Downloads folder.
  8. now i moved the ChromeDriver 73.0.3683.68 file to two places - usr/local/bin and usr/bin in my system.
  9. there was already a chromedriver file in usr/local/bin .
  10. to move the file - USER@DESKTOP:~/Downloads$ sudo mv -f ~/Downloads/chromedriver /usr/local/bin/chromedriver and USER@DESKTOP:~/Downloads$ sudo mv -f ~/Downloads/chromedriver /usr/bin/chromedriver you are saying you want to move the file chromedriver from first location to other means replacing any files already in those locations with same name.

  11. Last all i did was. close the vscode and relaunched it. and ran my code node library.js . and it worked it the chrome browser for me. TOOK AN HOUR FOR ME TO GO THROUGH AROUND 35-40 STACK-OVERFLOW AND RANDOM ONLINE RESOURCES/QUESTION-ANSWERS BUT WAS WORTH IT. :)

SOURCE CODE : LIBRARY.JS

var webdriver = require('selenium-webdriver');

var By = webdriver.By;

var until = webdriver.until;

var driver = new webdriver.Builder().forBrowser('chrome').build();

driver.get('https://www.google.com');

Upvotes: 1

Madhan Raj
Madhan Raj

Reputation: 1442

Try the below command from terminal to install particular version

webdriver-manager update --versions.chrome 2.46

Hope it helps you

Upvotes: 0

Related Questions