I followed the instruction from here (pause command in nightwatch), in order to create a custom command which gets the current used selector (css or xpath).
var util = require('util');
var events = require('events');
function GetSelector() {
events.EventEmitter.call(this);
}
util.inherits(GetSelector, events.EventEmitter);
GetSelector.prototype.command = function (callback) {
callback(this.client.locateStrategy);
};
module.exports = GetSelector;
The implementation gets the current selector, although the program stuck when the custom command is called.
browser
.getSelector(function (currentSelector) {
console.log('getSelector: ' + currentSelector);
})
I have also tried to wrap around with "self.perform" as suggested here, unfortunatelly without any luck.
GetSelector.prototype.command = function (browser, callback) {
browser.perform(function () {
callback(this.client.locateStrategy);
})
};
What am I missing?
Thanks, in advance!
via Vitali Dettling
No comments:
Post a Comment