From f533341085921409d16d577e38ba1745c37a17b7 Mon Sep 17 00:00:00 2001 From: Dmitry Shirokov Date: Fri, 11 Dec 2015 14:44:21 +1100 Subject: [PATCH] bug(driverProvider): fix driver path generation for *nix platforms Makes error messages better --- README.md | 3 ++- lib/driverProviders/direct.js | 17 ++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index af53511d1..9683166ff 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Protractor [![Build Status](https://travis-ci.org/angular/protractor.png?branch=master)](https://travis-ci.org/angular/protractor) [![Join the chat at https://gitter.im/angular/protractor](https://badges.gitter.im/angular/protractor.svg)](https://gitter.im/angular/protractor) ========== -[Protractor](http://angular.github.io/protractor) is an end-to-end test framework for [AngularJS](http://angularjs.org/) applications. Protractor is a [Node.js](http://nodejs.org/) program built on top of [WebDriverJS](https://github.com/SeleniumHQ/selenium/wiki/WebDriverJs). Protractor runs tests against your application running in a real browser, interacting with it as a user would. +[Protractor](http://angular.github.io/protractor) is an end-to-end test framework for [AngularJS](http://angularjs.org/) applications. Protractor is a [Node.js](http://nodejs.org/) program built on top of [WebDriverJS](https://github.com/SeleniumHQ/selenium/wiki/WebDriverJs). Protractor runs tests against your application running in a real browser, interacting with it as a user would. Compatibility ------------- @@ -40,6 +40,7 @@ Clone the github repository: git clone https://github.com/angular/protractor.git cd protractor npm install + ./bin/webdriver-manager update cd website npm install cd .. diff --git a/lib/driverProviders/direct.js b/lib/driverProviders/direct.js index 6f1ff71c4..f8155f048 100644 --- a/lib/driverProviders/direct.js +++ b/lib/driverProviders/direct.js @@ -51,17 +51,16 @@ DirectDriverProvider.prototype.getNewDriver = function() { var driver; switch (this.config_.capabilities.browserName) { case 'chrome': - var chromeDriverFile = this.config_.chromeDriver || - path.resolve(__dirname, '../../selenium/chromedriver'); + var defaultChromeDriverPath = path.resolve(__dirname, '../../selenium/chromedriver'); + + if (process.platform.indexOf('win') === 0) { + defaultChromeDriverPath += '.exe'; + } + + var chromeDriverFile = this.config_.chromeDriver || defaultChromeDriverPath; - // Check if file exists, if not try .exe or fail accordingly if (!fs.existsSync(chromeDriverFile)) { - chromeDriverFile += '.exe'; - // Throw error if the client specified conf chromedriver and its not found - if (!fs.existsSync(chromeDriverFile)) { - throw new Error('Could not find chromedriver at ' + - chromeDriverFile); - } + throw new Error('Could not find chromedriver at ' + chromeDriverFile); } var service = new chrome.ServiceBuilder(chromeDriverFile).build();