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

Commit

Permalink
chore(webdriver): update selenium-webdriver to 2.40.0
Browse files Browse the repository at this point in the history
  • Loading branch information
juliemr committed Mar 5, 2014
1 parent b26fa7b commit 6603a7e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 38 deletions.
67 changes: 30 additions & 37 deletions lib/locators.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,17 @@ util.inherits(ProtractorBy, WebdriverBy);
*/
ProtractorBy.prototype.addLocator = function(name, script) {
this[name] = function() {
var toArray = function(arguments) {
var locatorArguments = [];
for (var i = 0; i < arguments.length; i++) {
locatorArguments.push(arguments[i]);
}
return locatorArguments;
}
var buildFindElementsArguments = function(
locator, locatorArguments, scope) {
var findArguments = locatorArguments.slice(0);
findArguments.unshift(locator);
findArguments.push(scope);
return findArguments;
}

var locatorArguments = toArray(arguments);
var locatorArguments = arguments;
return {
findElementsOverride: function(driver, using) {
return driver.findElements.apply(driver, buildFindElementsArguments(
webdriver.By.js(script), locatorArguments, using));
var findElementArguments = [script];
for (var i = 0; i < locatorArguments.length; i++) {
findElementArguments.push(locatorArguments[i]);
}
findElementArguments.push(using);

return driver.findElements(
webdriver.By.js.apply(webdriver.By, findElementArguments));
},
message: 'by.' + name + '("' + locatorArguments + '")'
};
Expand Down Expand Up @@ -80,8 +71,8 @@ ProtractorBy.prototype.binding = function(bindingDescriptor) {
return {
findElementsOverride: function(driver, using) {
return driver.findElements(
webdriver.By.js(clientSideScripts.findBindings),
bindingDescriptor, using);
webdriver.By.js(clientSideScripts.findBindings,
bindingDescriptor, using));
},
message: 'by.binding("' + bindingDescriptor + '")'
};
Expand All @@ -100,7 +91,7 @@ ProtractorBy.prototype.select = function(model) {
return {
findElementsOverride: function(driver, using) {
return driver.findElements(
webdriver.By.js(clientSideScripts.findSelects), model, using);
webdriver.By.js(clientSideScripts.findSelects, model, using));
},
message: 'by.select("' + model + '")'
};
Expand All @@ -117,7 +108,7 @@ ProtractorBy.prototype.selectedOption = function(model) {
return {
findElementsOverride: function(driver, using) {
return driver.findElements(
webdriver.By.js(clientSideScripts.findSelectedOptions), model, using);
webdriver.By.js(clientSideScripts.findSelectedOptions, model, using));
},
message: 'by.selectedOption("' + model + '")'
};
Expand All @@ -135,7 +126,7 @@ ProtractorBy.prototype.input = function(model) {
return {
findElementsOverride: function(driver, using) {
return driver.findElements(
webdriver.By.js(clientSideScripts.findInputs), model, using);
webdriver.By.js(clientSideScripts.findInputs, model, using));
},
message: 'by.input("' + model + '")'
};
Expand All @@ -159,7 +150,7 @@ ProtractorBy.prototype.model = function(model) {
return {
findElementsOverride: function(driver, using) {
return driver.findElements(
webdriver.By.js(clientSideScripts.findByModel), model, using);
webdriver.By.js(clientSideScripts.findByModel, model, using));
},
message: 'by.model("' + model + '")'
};
Expand All @@ -181,7 +172,8 @@ ProtractorBy.prototype.buttonText = function(searchText) {
return {
findElementsOverride: function(driver, using) {
return driver.findElements(
webdriver.By.js(clientSideScripts.findByButtonText), searchText, using);
webdriver.By.js(clientSideScripts.findByButtonText,
searchText, using));
},
message: 'by.buttonText("' + searchText + '")'
};
Expand All @@ -203,7 +195,8 @@ ProtractorBy.prototype.partialButtonText = function(searchText) {
return {
findElementsOverride: function(driver, using) {
return driver.findElements(
webdriver.By.js(clientSideScripts.findByPartialButtonText), searchText, using);
webdriver.By.js(clientSideScripts.findByPartialButtonText,
searchText, using));
},
message: 'by.partialButtonText("' + searchText + '")'
};
Expand All @@ -222,7 +215,7 @@ ProtractorBy.prototype.textarea = function(model) {
return {
findElementsOverride: function(driver, using) {
return driver.findElements(
webdriver.By.js(clientSideScripts.findTextareas), model, using);
webdriver.By.js(clientSideScripts.findTextareas, model, using));
},
message: 'by.textarea("' + model + '")'
};
Expand Down Expand Up @@ -257,24 +250,24 @@ ProtractorBy.prototype.repeater = function(repeatDescriptor) {
return {
findElementsOverride: function(driver, using) {
return driver.findElements(
webdriver.By.js(clientSideScripts.findAllRepeaterRows),
repeatDescriptor, using);
webdriver.By.js(clientSideScripts.findAllRepeaterRows,
repeatDescriptor, using));
},
message: 'by.repeater("' + repeatDescriptor + '")',
row: function(index) {
return {
findElementsOverride: function(driver, using) {
return driver.findElements(
webdriver.By.js(clientSideScripts.findRepeaterRows),
repeatDescriptor, index, using);
webdriver.By.js(clientSideScripts.findRepeaterRows,
repeatDescriptor, index, using));
},
message: 'by.repeater(' + repeatDescriptor + '").row("' + index + '")"',
column: function(binding) {
return {
findElementsOverride: function(driver, using) {
return driver.findElements(
webdriver.By.js(clientSideScripts.findRepeaterElement),
repeatDescriptor, index, binding, using);
webdriver.By.js(clientSideScripts.findRepeaterElement,
repeatDescriptor, index, binding, using));
},
message: 'by.repeater("' + repeatDescriptor + '").row("' + index +
'").column("' + binding + '")'
Expand All @@ -286,17 +279,17 @@ ProtractorBy.prototype.repeater = function(repeatDescriptor) {
return {
findElementsOverride: function(driver, using) {
return driver.findElements(
webdriver.By.js(clientSideScripts.findRepeaterColumn),
repeatDescriptor, binding, using);
webdriver.By.js(clientSideScripts.findRepeaterColumn,
repeatDescriptor, binding, using));
},
message: 'by.repeater("' + repeatDescriptor + '").column("' + binding +
'")',
row: function(index) {
return {
findElementsOverride: function(driver, using) {
return driver.findElements(
webdriver.By.js(clientSideScripts.findRepeaterElement),
repeatDescriptor, index, binding, using);
webdriver.By.js(clientSideScripts.findRepeaterElement,
repeatDescriptor, index, binding, using));
},
message: 'by.repeater("' + repeatDescriptor + '").column("' +
binding + '").row("' + index + '")'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"author": "Julie Ralph <ju.ralph@gmail.com>",
"dependencies": {
"selenium-webdriver": "~2.39.0",
"selenium-webdriver": "~2.40.0",
"minijasminenode": ">=0.2.7",
"saucelabs": "~0.1.0",
"glob": ">=3.1.14",
Expand Down

0 comments on commit 6603a7e

Please sign in to comment.