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

Commit 25cf88c

Browse files
elgalujuliemr
authored andcommittedAug 20, 2014
feat(ElementArrayFinder): keep a reference to the original locator
1 parent 0da1e0c commit 25cf88c

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
 

‎lib/protractor.js

+7
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ var buildElementHelper = function(ptor) {
9898
this.parentElementFinder_ = opt_parentElementFinder || null;
9999
};
100100

101+
/**
102+
* @return {webdriver.Locator}
103+
*/
104+
ElementArrayFinder.prototype.locator = function() {
105+
return this.locator_;
106+
};
107+
101108
/**
102109
* Returns the array of WebElements represented by this ElementArrayFinder.
103110
*

‎spec/basic/elements_spec.js

+9
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,15 @@ describe('ElementFinder', function() {
172172
});
173173
});
174174

175+
it('should keep a reference to the array original locator', function() {
176+
var byCss = by.css('.menu li a');
177+
var byModel = by.model('color');
178+
browser.get('index.html#/form');
179+
180+
expect(element.all(byCss).locator()).toEqual(byCss);
181+
expect(element.all(byModel).locator()).toEqual(byModel);
182+
});
183+
175184
it('should map each element on array and with promises', function() {
176185
browser.get('index.html#/form');
177186
var labels = element.all(by.css('.menu li a')).map(function(elm, index) {

0 commit comments

Comments
 (0)
This repository has been archived.