Skip to content

Commit

Permalink
Fix a handful of js errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jleyba committed Aug 1, 2014
1 parent 19351a8 commit 8f988e0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion javascript/webdriver/actionsequence.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ webdriver.ActionSequence.prototype.mouseMove = function(location, opt_offset) {
} else {
// The interactions API expect the element ID to be encoded as a simple
// string, not the usual JSON object.
var id = /** @type {!webdriver.WebElement} */ (location).toWireValue().
var id = /** @type {!webdriver.WebElement} */ (location).getId().
then(function(value) {
return value['ELEMENT'];
});
Expand Down
2 changes: 1 addition & 1 deletion javascript/webdriver/promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ webdriver.promise.Thenable = function() {};
* Cancels the computation of this promise's value, rejecting the promise in the
* process. This method is a no-op if the promise has alreayd been resolved.
*
* @param {*} reason The reason this promise is being cancelled. If not an
* @param {*=} opt_reason The reason this promise is being cancelled. If not an
* {@code Error}, one will be created using the value's string
* representation.
*/
Expand Down
18 changes: 8 additions & 10 deletions javascript/webdriver/webdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ webdriver.WebDriver.toWireValue_ = function(obj) {
webdriver.WebDriver.toWireValue_));
case 'object':
if (obj instanceof webdriver.WebElement) {
return obj.getId_();
return obj.getId();
}
if (goog.isFunction(obj.toJSON)) {
return webdriver.promise.fulfilled(obj.toJSON());
Expand Down Expand Up @@ -1403,7 +1403,7 @@ webdriver.WebDriver.TargetLocator.prototype.activeElement = function() {
var id = this.driver_.schedule(
new webdriver.Command(webdriver.CommandName.GET_ACTIVE_ELEMENT),
'WebDriver.switchTo().activeElement()');
return new webdriver.WebElementPromise(driver, id);
return new webdriver.WebElementPromise(this.driver_, id);
};


Expand Down Expand Up @@ -1583,7 +1583,7 @@ webdriver.WebElement.equals = function(a, b) {
if (a == b) {
return webdriver.promise.fulfilled(true);
}
var ids = [a.getId_(), b.getId_()];
var ids = [a.getId(), b.getId()];
return webdriver.promise.all(ids).then(function(ids) {
// If the two element's have the same ID, they should be considered
// equal. Otherwise, they may still be equivalent, but we'll need to
Expand Down Expand Up @@ -1613,10 +1613,9 @@ webdriver.WebElement.prototype.getDriver = function() {
* @return {!webdriver.promise.Promise.<webdriver.WebElement.Id>} A promise
* that resolves to this element's JSON representation as defined by the
* WebDriver wire protocol.
* @private
* @see http://code.google.com/p/selenium/wiki/JsonWireProtocol
*/
webdriver.WebElement.prototype.getId_ = function() {
webdriver.WebElement.prototype.getId = function() {
return this.id_;
};

Expand All @@ -1634,7 +1633,7 @@ webdriver.WebElement.prototype.getId_ = function() {
* @private
*/
webdriver.WebElement.prototype.schedule_ = function(command, description) {
command.setParameter('id', this.getId_());
command.setParameter('id', this.getId());
return this.driver_.schedule(command, description);
};

Expand Down Expand Up @@ -2034,8 +2033,7 @@ webdriver.WebElement.prototype.getInnerHtml = function() {
* @final
*/
webdriver.WebElementPromise = function(driver, el) {
var unused = webdriver.promise.defer();
webdriver.WebElement.call(this, driver, unused.promise);
webdriver.WebElement.call(this, driver, {'ELEMENT': 'unused'});

/** @override */
this.cancel = goog.bind(el.cancel, el);
Expand All @@ -2057,9 +2055,9 @@ webdriver.WebElementPromise = function(driver, el) {
* resolved.
* @override
*/
this.getId_ = function() {
this.getId = function() {
return el.then(function(el) {
return el.getId_();
return el.getId();
});
};
};
Expand Down

0 comments on commit 8f988e0

Please sign in to comment.