admc / wd

A node.js client for webdriver/selenium 2.
Other
1.53k stars 402 forks source link

asserters.nonEmptyText TypeError: _(...).trim(...).value is not a function #557

Closed jtupa closed 5 years ago

jtupa commented 5 years ago

After updating wd from version 1.9 to 1.10, the nonEmptyText is throwing a TypeError right after .trim().

var nonEmptyText = new Asserter( function (target, cb) { target.text(function(err, text) { if(err) { return cb(err); } var satisfied = text && _(text).trim().value().length >0; cb(null, satisfied, satisfied? text : undefined); }); } );

The arguments being passed in for "err" is null and for "text" is a valid string ("asdf"). I was expecting the execution to finish and the callback to be invoked, but that did not happen because of the TypeError.

Proposed Solution: remove calling ".value()"

admc commented 5 years ago

Yeah that .value() call appears to be no longer necessary and breaking everywhere it's used. I'll do a mass removal now.

admc commented 5 years ago

Ah this has been fixed in master: https://github.com/admc/wd/blob/master/lib/asserters.js#L19

khanhdodang commented 5 years ago

@jtupa & @admc This issue has been fixed, so we can close this ticket. Thanks.