From 88dd568c5295234a5211a23e12666e199606e437 Mon Sep 17 00:00:00 2001 From: davinkevin Date: Fri, 1 Apr 2016 11:46:53 +0200 Subject: [PATCH] fix(NoSuchElementError): add 'new' keyword to instantiate class The class NoSuchElementError is called without the new keyword in the `ElementArrayFinder.prototype.count` causing a `Class constructors cannot be invoked without 'new'` closes #3079 --- lib/element.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/element.js b/lib/element.js index 04817622e..9f7b81aa0 100644 --- a/lib/element.js +++ b/lib/element.js @@ -340,7 +340,7 @@ ElementArrayFinder.prototype.count = function() { return this.getWebElements().then(function(arr) { return arr.length; }, function(err) { - if (err.code == webdriver.error.NoSuchElementError()) { + if (err.code == new webdriver.error.NoSuchElementError()) { return 0; } else { throw err;