Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit f7c3c37

Browse files
committed
feat(webdriver): update to WebDriverJS 2.43.5
Breaking Changes WebDriverJS has introduced changes in the way that Promises are handled in version 2.43. See https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/CHANGES.md - `webdriver.WebElement` has now been split into `webdriver.WebElementPromise` and `webdriver.WebElement` so that it does not resolve to itself. This change should be largely transparent to users. - `WebElement.toWireValue` has been removed.
1 parent f3ebd54 commit f7c3c37

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

lib/protractor.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var DEFER_LABEL = 'NG_DEFER_BOOTSTRAP!';
1212
var WEB_ELEMENT_FUNCTIONS = [
1313
'click', 'sendKeys', 'getTagName', 'getCssValue', 'getAttribute', 'getText',
1414
'getSize', 'getLocation', 'isEnabled', 'isSelected', 'submit', 'clear',
15-
'isDisplayed', 'getOuterHtml', 'getInnerHtml', 'toWireValue'];
15+
'isDisplayed', 'getOuterHtml', 'getInnerHtml', 'getId'];
1616

1717
var STACK_SUBSTRINGS_TO_FILTER = [
1818
'node_modules/minijasminenode/lib/',
@@ -198,9 +198,10 @@ var buildElementHelper = function(ptor) {
198198
childrenPromiseList.push(childrenPromise);
199199
});
200200

201+
201202
// Resolve the list of Promise<List<child_web_elements>> and merge into
202203
// a single list
203-
return webdriver.promise.fullyResolved(childrenPromiseList).then(
204+
return webdriver.promise.all(childrenPromiseList).then(
204205
function(resolved) {
205206
var childrenList = [];
206207
resolved.forEach(function(resolvedE) {
@@ -429,7 +430,7 @@ var buildElementHelper = function(ptor) {
429430
arr.forEach(function(webElem) {
430431
list.push(actionFn(webElem));
431432
});
432-
return list;
433+
return webdriver.promise.all(list);
433434
});
434435
return new ElementArrayFinder(this.getWebElements, this.locator_, actionResults);
435436
};
@@ -477,7 +478,7 @@ var buildElementHelper = function(ptor) {
477478
*/
478479
ElementArrayFinder.prototype.then = function(fn, errorFn) {
479480
if (this.actionResults_) {
480-
return webdriver.promise.fullyResolved(this.actionResults_).then(fn, errorFn);
481+
return this.actionResults_.then(fn, errorFn);
481482
} else {
482483
return this.asElementFinders_().then(fn, errorFn);
483484
}
@@ -747,7 +748,7 @@ var buildElementHelper = function(ptor) {
747748
function(parentWebElements) {
748749
return parentWebElements[0];
749750
});
750-
return new webdriver.WebElement(ptor.driver, id);
751+
return new webdriver.WebElementPromise(ptor.driver, id);
751752
};
752753

753754
/**

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
"author": "Julie Ralph <[email protected]>",
1414
"dependencies": {
1515
"request": "~2.36.0",
16-
"selenium-webdriver": "2.42.1",
16+
"selenium-webdriver": "2.43.5",
1717
"minijasminenode": "1.1.1",
18-
"jasminewd": "1.0.4",
18+
"jasminewd": "1.1.0",
1919
"saucelabs": "~0.1.0",
2020
"glob": "~3.2",
2121
"adm-zip": "0.4.4",

spec/basic/elements_spec.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ describe('ElementFinder', function() {
99
it('should return the same result as browser.findElement', function() {
1010
browser.get('index.html#/form');
1111
var nameByElement = element(by.binding('username'));
12+
1213
expect(nameByElement.getText()).toEqual(
1314
browser.findElement(by.binding('username')).getText());
1415
});
@@ -161,13 +162,14 @@ describe('ElementFinder', function() {
161162
var elem = element(by.binding('greeting'));
162163

163164
elem.then(function(elem2) {
164-
expect(elem.toWireValue()).toEqual(elem2.toWireValue());
165+
expect(elem.getId()).toEqual(elem2.getId());
165166
});
166167
});
167168

168169
it('should not resolve to itself', function() {
169170
browser.get('index.html#/form');
170171
var elem1 = element(by.binding('greeting'));
172+
171173
elem1.then(function(result) {
172174
expect(result === elem1).toBe(false);
173175
});

0 commit comments

Comments
 (0)