Protractor: how to access the "ElementFinder" class from the test

I am looking for a way to extend the ElementFinder protractor class from a test. Is there a way to access the constructor / constructor of the ElementFinder protokator so that I can dynamically expand it from the test?

A reference to all global variables opened by the protractor will also be very useful.

+7
angularjs protractor
source share
1 answer

I am using the $('').constructor; workaround below $('').constructor; to extend ElementFinder functions to # 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 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 height as a {@code {number}}. */ ElementFinder.prototype.getHeight = function() { return this.getSize().then(function(size) { return size.height; }); }; 
+6
source share

All Articles