Sto utilizzando la soluzione alternativa $('').constructor;
per estendere le funzionalità di ElementFinder fino a #1102.
/**
* Current workaround until https://github.com/angular/protractor/issues/1102
* @type {Function}
*/
var ElementFinder = $('').constructor;
// Examples:
/**
* Schedules a command to compute the width of this element's
* bounding box, in pixels.
* @return {!webdriver.promise.Promise.<number>} A promise that will
* be resolved with the element's width as a {@code {number}}.
*/
ElementFinder.prototype.getWidth = function() {
return this.getSize().then(function(size) {
return size.width;
});
};
/**
* Schedules a command to compute the height of this element's
* bounding box, in pixels.
* @return {!webdriver.promise.Promise.<number>} A promise that will
* be resolved with the element's height as a {@code {number}}.
*/
ElementFinder.prototype.getHeight = function() {
return this.getSize().then(function(size) {
return size.height;
});
};
fonte
2014-08-27 04:51:10
FYI, ElementFinder sembra essere esposti ora: https://github.com/angular/protractor/pull/1633 & https://github.com/angular/protractor/issues/1584 – Snekse
Cool! puoi fornire tutti i passaggi? cosa 'pretendere' e così via? Può essere in una nuova risposta per esempio;) –