wd
wd copied to clipboard
waitForElementByCssSelector promise resolves with value in first arg
For example:
fn = function(err, v) {};
browser.get('http://google.com').then(fn) // it will pass v in second parameter
browser.waitForElementByCssSelector('a').then(fn) // it will pass v in first parameter
Please, make API more uniform. waitForElementByCssSelector is a first candidate.
I believe get should pass nothing, need to check.
I don't fully understand the question but this is just a hunch. maybe the fix would be to remove the '0' index in wd/lib/commands.js for all waitForElement line 1277:
var args = __slice.call(arguments, 0); => var args = __slice.call(arguments);
because it's different than what's in the implementation for commands.get():
line 499: var cb = findCallback(arguments);
promises do not use this form: fn = function(err, v)