From a3e8b4319d3e8b049e55e5c3c64a7fdb5a132ddf Mon Sep 17 00:00:00 2001 From: Craig Date: Thu, 1 Dec 2016 20:17:49 -0800 Subject: [PATCH] deps(selenium-webdriver): upgrade to selenium 3 (#3781) Note: with the upgrade, there might have breaking changes. Please see the selenium-webdriver changelog. - See [selenium-webdriver changelog](https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/CHANGES.md) - Removed method `WebDriver.prototype.isElementPresent` - Removed method `WebElement.prototype.getRawId` - Removed `getInnerHtml` and `getOutterHtml` - Dependency required for upgrade: use `jasminewd2@0.1.0-beta.0`. - Selenium-webdriver requires node version 6+, updating travis and circle yml to use node 6 and 7. - Use `instanceof` selenium-webdriver error instead of error code. Selenium-webdriver error codes have been deprecated. - Use executor with selenium-webdriver from `lib/http`. Deferred executor has been deprecated. - Fix quitting `driverProviders`. When calling `webdriver.quit`, the control flow is shutdown and will throw an error. - Driver provider for direct connect has been modified to use `ServiceBuilder` and to call the `Service` to `createSession` - Note: Since this upgrade is still using FF 47, direct connect for Firefox is required to pass "marionette: false" in the capabilities. If you do not pass marionette to false, it will look for gecko driver in the PATH. - Added a TODO to support FF after 48+ with direct connect and gecko driver. - Updated `browser.manage().addCookie('testcookie', 'Jane-1234');` to use `browser.manage().addCookie({name:'testcookie', value: 'Jane-1234'});` - Updated debug commons for breakpoint updated to selenium-webdriver `lib/http` line 432. - Debugger currently does not work. So `elementExplorer` for this current commit does not work. Additional work is required. - Since debugger does not work, interactive tests were disabled in `scripts/tests.js` - For mocha tests, `selenium-webdriver/testing` uses the global `it` and cannot be reassigned as Protractor's global `it`. Some code has been copied / modified to `lib/frameworks/mocha` to make this work. - Capabilities for Firefox 47 requires setting marionette to false. - Setup still requires selenium standalone server 2.53.1 for Firefox tests. Firefox version used is 47. - Using selenium standalone server 3, with Firefox 48+ tests fail with gecko driver still do not work. - Selenium standalone 3 + FF 49 + gecko driver 0.11.1 does not work - Selenium standalone 3 + FF 48 + gecko driver 0.11.1 appears to work for a single test but after it quits, selenium standalone no longer works with firefox. When firefox 48 exists, logs show the following: ``` 20:01:14.814 INFO - Executing: [delete session: e353fa1b-e266-4ec3-afb3-88f11a82473a]) [GFX1-]: Receive IPC close with reason=AbnormalShutdown [Child 30665] ###!!! ABORT: Aborting on channel error.: file /builds/slave/m-rel-m64-00000000000000000000/build/src/ipc/glue/MessageChannel.cpp, line 2052 [Child 30665] ###!!! ABORT: Aborting on channel error.: file /builds/slave/m-rel-m64-00000000000000000000/build/src/ipc/glue/MessageChannel.cpp, line 2052 ``` To be squashed - fix up attach session typo --- .travis.yml | 6 +- circle.yml | 4 +- lib/debugger.ts | 4 +- lib/debugger/debuggerCommons.js | 4 +- lib/driverProviders/attachSession.ts | 8 +- lib/driverProviders/direct.ts | 10 +- lib/element.ts | 14 +- lib/expectedConditions.ts | 2 +- lib/frameworks/mocha.js | 132 ++++++++++++++++-- lib/selenium-webdriver/webdriver.js | 9 -- package.json | 4 +- spec/basic/elements_spec.js | 6 +- spec/basic/expected_conditions_spec.js | 3 +- spec/dependencyTest/seleniumWebdriver_spec.js | 106 +++++++------- spec/dependencyTest/setup.js | 4 +- spec/directConnectConf.js | 4 +- spec/interaction/interaction_spec.js | 2 +- .../setCookies_spec.js | 2 +- 18 files changed, 211 insertions(+), 113 deletions(-) diff --git a/.travis.yml b/.travis.yml index b846414d2..c445d2dff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: node_js sudo: false node_js: - - "4" - "6" + - "7" env: global: @@ -24,9 +24,9 @@ matrix: - env: "JOB=bstack" exclude: - env: JOB=smoke - node_js: "6" + node_js: "7" - env: JOB=bstack - node_js: "6" + node_js: "7" addons: apt: diff --git a/circle.yml b/circle.yml index 9ceca4bfd..ab379f253 100644 --- a/circle.yml +++ b/circle.yml @@ -1,10 +1,10 @@ machine: + node: + version: 6.9.1 environment: # Fix issue with selenium-server in containers. # See http://github.com/SeleniumHQ/docker-selenium/issues/87 DBUS_SESSION_BUS_ADDRESS: /dev/null - post: - - npm install -g npm@3 dependencies: override: diff --git a/lib/debugger.ts b/lib/debugger.ts index 6827a26d1..6a87d8261 100644 --- a/lib/debugger.ts +++ b/lib/debugger.ts @@ -106,7 +106,7 @@ export class DebugHelper { }); let pausePromise = flow.execute(() => { - return debuggerReadyPromise.then(() => { + return debuggerReadyPromise.promise.then(() => { // Necessary for backward compatibility with node < 0.12.0 return this.browserUnderDebug_.executeScriptWithDescription('', 'empty debugger hook'); }); @@ -255,7 +255,7 @@ export class DebugHelper { } }); - return doneDeferred.then( + return doneDeferred.promise.then( () => { this.debuggerValidated_ = true; }, diff --git a/lib/debugger/debuggerCommons.js b/lib/debugger/debuggerCommons.js index 62f6bcb83..f0e039eed 100644 --- a/lib/debugger/debuggerCommons.js +++ b/lib/debugger/debuggerCommons.js @@ -17,8 +17,8 @@ exports.attachDebugger = function(pid, opt_port) { client.once('ready', function() { client.setBreakpoint({ type: 'scriptRegExp', - target: '.*command\.js', //jshint ignore:line - line: 250 + target: 'lib/http\.js', //jshint ignore:line + line: 432 }, function() { process.send('ready'); client.reqContinue(function() { diff --git a/lib/driverProviders/attachSession.ts b/lib/driverProviders/attachSession.ts index 58f4e4e35..f5e102404 100644 --- a/lib/driverProviders/attachSession.ts +++ b/lib/driverProviders/attachSession.ts @@ -5,13 +5,14 @@ */ import * as q from 'q'; import {WebDriver} from 'selenium-webdriver'; -import * as executors from 'selenium-webdriver/executors'; import {Config} from '../config'; import {Logger} from '../logger'; import {DriverProvider} from './driverProvider'; +const http = require('selenium-webdriver/http'); + let logger = new Logger('attachSession'); export class AttachSession extends DriverProvider { @@ -38,8 +39,9 @@ export class AttachSession extends DriverProvider { * @return {WebDriver} webdriver instance */ getNewDriver(): WebDriver { - let executor = executors.createExecutor(this.config_.seleniumAddress); - let newDriver = WebDriver.attachToSession(executor, this.config_.seleniumSessionId); + var httpClient = new http.HttpClient(this.config_.seleniumAddress); + var executor = new http.Executor(httpClient); + var newDriver = WebDriver.attachToSession(executor, this.config_.seleniumSessionId); this.drivers_.push(newDriver); return newDriver; } diff --git a/lib/driverProviders/direct.ts b/lib/driverProviders/direct.ts index 5710b7da4..62de980ff 100644 --- a/lib/driverProviders/direct.ts +++ b/lib/driverProviders/direct.ts @@ -75,14 +75,18 @@ export class Direct extends DriverProvider { '. Run \'webdriver-manager update\' to download binaries.'); } - let service = new ChromeServiceBuilder(chromeDriverFile).build(); - driver = new ChromeDriver(new Capabilities(this.config_.capabilities), service); + let chromeService = new ChromeServiceBuilder(chromeDriverFile).build(); + driver = ChromeDriver.createSession(new Capabilities(this.config_.capabilities), chromeService); break; case 'firefox': if (this.config_.firefoxPath) { this.config_.capabilities['firefox_binary'] = this.config_.firefoxPath; } - driver = new FirefoxDriver(this.config_.capabilities); + + // TODO(cnishina): Add in a service builder with marionette. Direct connect + // currently supports FF legacy version 47. + driver = + FirefoxDriver.createSession(new Capabilities(this.config_.capabilities)); break; default: throw new BrowserError( diff --git a/lib/element.ts b/lib/element.ts index 724c7ac45..5dc5c7c06 100644 --- a/lib/element.ts +++ b/lib/element.ts @@ -14,8 +14,8 @@ export interface WebdriverWebElement extends WebElement {} let WEB_ELEMENT_FUNCTIONS = [ 'click', 'sendKeys', 'getTagName', 'getCssValue', 'getAttribute', 'getText', 'getSize', - 'getLocation', 'isEnabled', 'isSelected', 'submit', 'clear', 'isDisplayed', 'getOuterHtml', - 'getInnerHtml', 'getId', 'getRawId', 'serialize', 'takeScreenshot' + 'getLocation', 'isEnabled', 'isSelected', 'submit', 'clear', 'isDisplayed', 'getId', 'serialize', + 'takeScreenshot' ] as (keyof WebdriverWebElement)[]; /** @@ -419,8 +419,8 @@ export class ElementArrayFinder extends WebdriverWebElement { (arr: WebElement[]) => { return arr.length; }, - (err: IError) => { - if (err.code && err.code == (new wderror.NoSuchSessionError() as any).code) { + (err: Error) => { + if (err instanceof wderror.NoSuchElementError) { return 0; } else { throw err; @@ -1065,15 +1065,15 @@ export class ElementFinder extends WebdriverWebElement { return true; // is present, whether it is enabled or not }, (err: any) => { - if (err.code == (new wderror.StaleElementReferenceError() as any).code) { + if (err instanceof wderror.StaleElementReferenceError) { return false; } else { throw err; } }); }, - (err: any) => { - if (err.code == (new wderror.NoSuchElementError() as any).code) { + (err: Error) => { + if (err instanceof wderror.NoSuchElementError) { return false; } else { throw err; diff --git a/lib/expectedConditions.ts b/lib/expectedConditions.ts index 483e982aa..9f006aea4 100644 --- a/lib/expectedConditions.ts +++ b/lib/expectedConditions.ts @@ -160,7 +160,7 @@ export class ProtractorExpectedConditions { return true; }, (err: any) => { - if (err.code == (new wderror.NoSuchAlertError() as any).code) { + if (err instanceof wderror.NoSuchAlertError) { return false; } else { throw err; diff --git a/lib/frameworks/mocha.js b/lib/frameworks/mocha.js index 4dbae5e05..8b65007de 100644 --- a/lib/frameworks/mocha.js +++ b/lib/frameworks/mocha.js @@ -1,4 +1,5 @@ var q = require('q'); +var promise = require('selenium-webdriver').promise; /** * Execute the Runner's test cases through Mocha. @@ -17,19 +18,14 @@ exports.run = function(runner, specs) { // wait until then to load mocha-webdriver adapters as well. mocha.suite.on('pre-require', function() { try { - // We need to re-wrap all of the global functions, which selenium-webdriver/ - // testing only does when it is required. So first we must remove it from - // the cache. - delete require.cache[require.resolve('selenium-webdriver/testing')]; - var mochaAdapters = require('selenium-webdriver/testing'); - global.after = mochaAdapters.after; - global.afterEach = mochaAdapters.afterEach; - global.before = mochaAdapters.before; - global.beforeEach = mochaAdapters.beforeEach; - - global.it = mochaAdapters.it; - global.it.only = global.iit = mochaAdapters.iit; - global.it.skip = global.xit = mochaAdapters.xit; + global.after = wrapped(global.after); + global.afterEach = wrapped(global.afterEach); + global.before = wrapped(global.before); + global.beforeEach = wrapped(global.beforeEach); + + global.it = wrapped(global.it); + global.it.only = wrapped(global.iit); + global.it.skip = wrapped(global.xit); } catch (err) { deferred.reject(err); } @@ -38,7 +34,6 @@ exports.run = function(runner, specs) { mocha.loadFiles(); runner.runTestPreparer().then(function() { - specs.forEach(function(file) { mocha.addFile(file); }); @@ -99,3 +94,112 @@ exports.run = function(runner, specs) { return deferred.promise; }; + + + +var flow = (function() { + var initial = process.env['SELENIUM_PROMISE_MANAGER']; + try { + process.env['SELENIUM_PROMISE_MANAGER'] = '1'; + return promise.controlFlow(); + } finally { + if (initial === undefined) { + delete process.env['SELENIUM_PROMISE_MANAGER']; + } else { + process.env['SELENIUM_PROMISE_MANAGER'] = initial; + } + } +})(); + +/** + * Wraps a function on Mocha's BDD interface so it runs inside a + * webdriver.promise.ControlFlow and waits for the flow to complete before + * continuing. + * @param {!Function} globalFn The function to wrap. + * @return {!Function} The new function. + */ +function wrapped(globalFn) { + return function() { + if (arguments.length === 1) { + return globalFn(makeAsyncTestFn(arguments[0])); + + } else if (arguments.length === 2) { + return globalFn(arguments[0], makeAsyncTestFn(arguments[1])); + + } else { + throw Error('Invalid # arguments: ' + arguments.length); + } + }; +} + +/** + * Wraps a function so that all passed arguments are ignored. + * @param {!Function} fn The function to wrap. + * @return {!Function} The wrapped function. + */ +function seal(fn) { + return function() { + fn(); + }; +} + +/** + * Make a wrapper to invoke caller's test function, fn. Run the test function + * within a ControlFlow. + * + * Should preserve the semantics of Mocha's Runnable.prototype.run (See + * https://github.com/mochajs/mocha/blob/master/lib/runnable.js#L192) + * + * @param {!Function} fn + * @return {!Function} + */ +function makeAsyncTestFn(fn) { + var isAsync = fn.length > 0; + var isGenerator = promise.isGenerator(fn); + if (isAsync && isGenerator) { + throw new TypeError( + 'generator-based tests must not take a callback; for async testing,' + + ' return a promise (or yield on a promise)'); + } + + var ret = /** @type {function(this: mocha.Context)}*/ function(done) { + var self = this; + var runTest = function(resolve, reject) { + try { + if (self.isAsync) { + fn.call(self, function(err) { err ? reject(err) : resolve(); }); + } else if (self.isGenerator) { + resolve(promise.consume(fn, self)); + } else { + resolve(fn.call(self)); + } + } catch (ex) { + reject(ex); + } + }; + + if (!promise.USE_PROMISE_MANAGER) { + new promise.Promise(runTest).then(seal(done), done); + return; + } + + var runnable = this.runnable(); + var mochaCallback = runnable.callback; + runnable.callback = function() { + flow.reset(); + return mochaCallback.apply(this, arguments); + }; + + flow.execute(function controlFlowExecute() { + return new promise.Promise(function(fulfill, reject) { + return runTest(fulfill, reject); + }, flow); + }, runnable.fullTitle()).then(seal(done), done); + }; + + ret.toString = function() { + return fn.toString(); + }; + + return ret; +} diff --git a/lib/selenium-webdriver/webdriver.js b/lib/selenium-webdriver/webdriver.js index f11a24338..5954791c2 100644 --- a/lib/selenium-webdriver/webdriver.js +++ b/lib/selenium-webdriver/webdriver.js @@ -415,15 +415,6 @@ webdriver.WebElement.prototype.getDriver = function() {}; */ webdriver.WebElement.prototype.getId = function() {}; - -/** - * Returns the raw ID string ID for this element. - * @returns {!webdriver.promise.Promise} A promise that resolves to this - * element's raw ID as a string value. - */ -webdriver.WebElement.prototype.getRawId = function() {}; - - /** * Returns a promise for the web element's serialized representation. * diff --git a/package.json b/package.json index 1d9895c89..c7529faec 100644 --- a/package.json +++ b/package.json @@ -20,11 +20,11 @@ "chalk": "^1.1.3", "glob": "^7.0.3", "jasmine": "2.4.1", - "jasminewd2": "0.0.10", + "jasminewd2": "0.1.0-beta.0", "optimist": "~0.6.0", "q": "1.4.1", "saucelabs": "~1.3.0", - "selenium-webdriver": "2.53.3", + "selenium-webdriver": "3.0.1", "source-map-support": "~0.4.0", "webdriver-manager": "^10.3.0" }, diff --git a/spec/basic/elements_spec.js b/spec/basic/elements_spec.js index f7fa0558f..eab44202f 100644 --- a/spec/basic/elements_spec.js +++ b/spec/basic/elements_spec.js @@ -463,19 +463,19 @@ describe('ElementArrayFinder', function() { ]); }); - it('should map and resolve multiple promises', function() { + fit('should map and resolve multiple promises', function() { browser.get('index.html#/form'); var labels = element.all(by.css('#animals ul li')).map(function(elm) { return { text: elm.getText(), - inner: elm.getInnerHtml() + tagName: elm.getTagName() }; }); var newExpected = function(expectedLabel) { return { text: expectedLabel, - inner: expectedLabel + tagName: 'li' }; }; diff --git a/spec/basic/expected_conditions_spec.js b/spec/basic/expected_conditions_spec.js index 916aa66b2..26b35d693 100644 --- a/spec/basic/expected_conditions_spec.js +++ b/spec/basic/expected_conditions_spec.js @@ -11,8 +11,7 @@ describe('expected conditions', function() { var alertButton = $('#alertbutton'); alertButton.click(); - browser.wait(protractor.ExpectedConditions.alertIsPresent(), 1000); - + browser.wait(protractor.ExpectedConditions.alertIsPresent(), 5000); browser.switchTo().alert().accept(); }); diff --git a/spec/dependencyTest/seleniumWebdriver_spec.js b/spec/dependencyTest/seleniumWebdriver_spec.js index c453a25cf..9b8c00ce3 100644 --- a/spec/dependencyTest/seleniumWebdriver_spec.js +++ b/spec/dependencyTest/seleniumWebdriver_spec.js @@ -3,24 +3,24 @@ var By = require('selenium-webdriver').By; var Setup = require('./setup'); var Chrome = require('selenium-webdriver/chrome'); var Firefox = require('selenium-webdriver/firefox'); -var Executors = require('selenium-webdriver/executors'); var SeleniumError = require('selenium-webdriver').error; var Remote = require('selenium-webdriver/remote'); var Testing = require('selenium-webdriver/testing'); var WEBDRIVER = { staticFunctions: ['attachToSession', 'createSession'], + instanceFunctions: ['actions', 'wait', 'sleep', 'getCurrentUrl', 'getTitle', 'takeScreenshot', 'getSession', 'getCapabilities', 'quit', 'touchActions', 'executeAsyncScript', 'call', 'wait', 'getWindowHandle', 'getAllWindowHandles', 'getPageSource', 'close', 'get', 'findElement', - 'isElementPresent', 'findElements', 'manage', 'navigate', 'switchTo'] + 'findElements', 'manage', 'navigate', 'switchTo'] }; + var WEBELEMENT = { - instanceFunctions: ['getDriver', 'getId', 'getRawId', - 'findElement', 'click', 'sendKeys', 'getTagName', 'getCssValue', - 'getAttribute', 'getText', 'getSize', 'getLocation', 'isEnabled', - 'isSelected', 'submit', 'clear', 'isDisplayed', 'takeScreenshot'] + instanceFunctions: ['getDriver', 'getId', 'findElement', 'click', 'sendKeys', 'getTagName', + 'getCssValue', 'getAttribute', 'getText', 'getSize', 'getLocation', 'isEnabled', 'isSelected', + 'submit', 'clear', 'isDisplayed', 'takeScreenshot'] }; var BY = { staticFunctions: ['className', 'css', 'id', 'linkText', 'js', 'name', @@ -35,75 +35,71 @@ var CHROME = { var FIREFOX = { staticFunction: 'Driver' }; -var EXECUTORS = { - staticFunction: 'createExecutor' -}; var TESTING = { - staticFunctions: ['after', 'afterEach', 'before', 'beforeEach', - 'describe', 'it', 'iit'] + instanceFunctions: ['after', 'afterEach', 'before', 'beforeEach', 'it', 'xit'] }; describe('selenium-webdriver dependency', function() { describe('require("selenium-webdriver").WebDriver', function() { - for (var pos1 in WEBDRIVER.staticFunctions) { - var staticFunc = WEBDRIVER.staticFunctions[pos1]; - it('should have a ' + staticFunc + ' function', function() { + it('should have static functions', function() { + for (var pos in WEBDRIVER.staticFunctions) { + var staticFunc = WEBDRIVER.staticFunctions[pos]; expect(typeof WebDriver[staticFunc] == 'function').toBe(true); - }); - } + } + }); - var webdriver = Setup.getWebDriver(); - for (var pos2 in WEBDRIVER.instanceFunctions) { - var instanceFunc = WEBDRIVER.instanceFunctions[pos2]; - it('should have a ' + instanceFunc + ' function', function() { + it('should have instance functions', function() { + var webdriver = Setup.getWebDriver(); + for (var pos in WEBDRIVER.instanceFunctions) { + var instanceFunc = WEBDRIVER.instanceFunctions[pos]; expect(typeof webdriver[instanceFunc] == 'function').toBe(true); - }); - } + } + }); }); + describe('require("selenium-webdriver").WebElement', function() { - var webElement = Setup.getWebElement(); - for (var pos in WEBELEMENT.instanceFunctions) { - var func = WEBELEMENT.instanceFunctions[pos]; - it('should have a ' + func + ' function', function() { + it('should have a instance functions', function() { + var webElement = Setup.getWebElement(); + for (var pos in WEBELEMENT.instanceFunctions) { + var func = WEBELEMENT.instanceFunctions[pos]; expect(typeof webElement[func] == 'function').toBe(true); - }); - } + } + }); }); + describe('require("selenium-webdriver").By', function() { - for (var pos in BY.staticFunctions) { - var func = BY.staticFunctions[pos]; - it('should have a ' + func + ' function', function() { + it('should have a static functions', function() { + for (var pos in BY.staticFunctions) { + var func = BY.staticFunctions[pos]; expect(typeof By[func] == 'function').toBe(true); - }); - } + } + }); }); + describe('require("selenium-webdriver").Session', function() { - var session = Setup.getSession(); - for (var pos in SESSION.instanceFunctions) { - var func = SESSION.instanceFunctions[pos]; - it('should have a ' + func + ' function', function() { + it('should have a instance functions', function() { + var session = Setup.getSession(); + for (var pos in SESSION.instanceFunctions) { + var func = SESSION.instanceFunctions[pos]; expect(typeof session[func] == 'function').toBe(true); - }); - } + } + }); }); + describe('require("selenium-webdriver/chrome")', function() { - for (var pos in CHROME.staticFunctions) { - var func = CHROME.staticFunctions[pos]; - it('should have a ' + func + ' function', function() { + it('should have a static functions', function() { + for (var pos in CHROME.staticFunctions) { + var func = CHROME.staticFunctions[pos]; expect(typeof Chrome[func] == 'function').toBe(true); - }); - } + } + }); }); + describe('require("selenium-webdriver/firefox")', function() { it('should have a ' + FIREFOX.staticFunction + ' function', function() { expect(typeof Firefox[FIREFOX.staticFunction] == 'function').toBe(true); }); }); - describe('require("selenium-webdriver/executors")', function() { - it('should have a ' + EXECUTORS.staticFunction + ' function', function() { - expect(typeof Executors[EXECUTORS.staticFunction] == 'function').toBe(true); - }); - }); describe('require("selenium-webdriver").error', function() { it('should have a NoSuchElementError function', function() { expect(typeof SeleniumError.NoSuchElementError == 'function').toBe(true); @@ -121,11 +117,13 @@ describe('selenium-webdriver dependency', function() { }); }); describe('require("selenium-webdriver/testing")', function() { - for (var pos in TESTING.staticFunctions) { - var func = TESTING.staticFunctions[pos]; - it('should have a ' + func + ' function', function() { + + it('should have functions', function() { + for (var pos in TESTING.instanceFunctions) { + var func = TESTING.instanceFunctions[pos]; expect(typeof Testing[func] == 'function').toBe(true); - }); - } + } + }); + }); }); diff --git a/spec/dependencyTest/setup.js b/spec/dependencyTest/setup.js index 4929b6b36..bf9dbd945 100644 --- a/spec/dependencyTest/setup.js +++ b/spec/dependencyTest/setup.js @@ -6,7 +6,7 @@ var WebElement = require('selenium-webdriver').WebElement; var Session = require('selenium-webdriver/lib/session').Session; // executors.js -var Executors = require('selenium-webdriver/executors'); +var Executor = require('selenium-webdriver/lib/command').Executor; var session = '1234'; var seleniumAddress = 'http://localhost:4444/wd/hub'; @@ -16,7 +16,7 @@ var capabilities = { var getExecutor = function() { - return Executors.createExecutor(seleniumAddress); + return new Executor(); }; var getWebDriver = function() { diff --git a/spec/directConnectConf.js b/spec/directConnectConf.js index b9858fdad..a63205475 100644 --- a/spec/directConnectConf.js +++ b/spec/directConnectConf.js @@ -5,11 +5,11 @@ exports.config = { directConnect: true, framework: 'jasmine', - multiCapabilities: [{ 'browserName': 'chrome' }, { - 'browserName': 'firefox' + 'browserName': 'firefox', + 'marionette': false }], baseUrl: env.baseUrl + '/ng1/', diff --git a/spec/interaction/interaction_spec.js b/spec/interaction/interaction_spec.js index 1a2f5719b..ae68ddb86 100644 --- a/spec/interaction/interaction_spec.js +++ b/spec/interaction/interaction_spec.js @@ -9,7 +9,7 @@ describe('Browser', function() { // throughout all of your tests). However, I'm forking browsers in my tests // and don't want to pile up my browser count. if (newBrowser) { - newBrowser.quit().then(function() { + newBrowser.quit().then(() => { done(); }); } else { diff --git a/spec/restartBrowserBetweenTests/setCookies_spec.js b/spec/restartBrowserBetweenTests/setCookies_spec.js index 9b7b4619b..c461db8f4 100644 --- a/spec/restartBrowserBetweenTests/setCookies_spec.js +++ b/spec/restartBrowserBetweenTests/setCookies_spec.js @@ -4,7 +4,7 @@ describe('pages with login', function() { it('should set a cookie', function() { browser.get(env.baseUrl + '/ng1/index.html'); - browser.manage().addCookie('testcookie', 'Jane-1234'); + browser.manage().addCookie({name:'testcookie', value: 'Jane-1234'}); // Make sure the cookie is set. browser.manage().getCookie('testcookie').then(function(cookie) {