Intern/Leadfoot : Getting error - Expecting a function in instanceof check, but got [object Object] on .Click() method -


i learning intern/leadfoot , trying write simple test. test logging user site , logging out user after verification on next page.

using chromedriver v2.21.

getting unknown error : expecting function in instanceof check, got [object object] click() method element. however, element being identified , value getvisibletext(). 

here test code:

define(function (require) {     var registersuite = require('intern!object');     var assert = require('intern/chai!assert');      registersuite({         name: 'acceptance',                       'login': function () {                       return this.remote                   .get(require.tourl('http://example.com'))                 .setfindtimeout(5000)                 .findbyxpath('id("ius-userid")')                     .click()                     .type('user@user.com')                     .end()                 .findbyxpath('id("ius-password")')                     .click()                     .type('password')                     .end()                 .findbyxpath('id("ius-sign-in-submit-btn")')                     .click()                                         .end()                                       .sleep(15000)         },          'homepage': function () {                        return this.remote                 .setfindtimeout(5000)                 .findbyxpath('id("userwelcome")')                                        .getvisibletext()                         .then(function (text) {                                                      assert.strictequal(text, 'welcome user@user.com!', 'vaerify that, home page logged in user displayed!');                     })                     .end()                 .findbyxpath('id("settingsandlogout")/a[2]')                      .getvisibletext()                         .then(function(text){                             console.log("the sign out link text :...", text.trim());                             assert.strictequal(text.trim(), 'sign out', 'verify that, sign out link present.');                         })                                       .click()                     .end()         }     }); }); 

and, here output:

listening on 0.0.0.0:9000 tunnel started ? created session chrome on platform (5fcd3559690a324e3a5a3db6cd367387) √ chrome on platform - acceptance - login (20.268s) sign out link text :... sign out x chrome on platform - acceptance - homepage (0.13s) unknownerror: [post http://localhost:4444/wd/hub/session/5fcd3559690a324e3a5a3db 6cd367387/element/0.8815118646376954-2/click] unknown error: expecting functio n in instanceof check, got [object object]   (session info: chrome=49.0.2623.112)   (driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7 c4),platform=windows nt 6.1 sp1 x86_64)   @ runrequest  <node_modules\leadfoot\session.js:88:40>   @ <node_modules\leadfoot\session.js:109:39>   @ new promise  <node_modules\dojo\promise.ts:411:3>   @ proxiedsession._post  <node_modules\leadfoot\session.js:63:10>   @ element._post  <node_modules\leadfoot\element.js:23:31>   @ element.click  <node_modules\leadfoot\element.js:138:15>   @ command.<anonymous>  <node_modules\leadfoot\command.js:680:19>   @ <node_modules\dojo\promise.ts:393:15>   @ run  <node_modules\dojo\promise.ts:237:7>   @ <node_modules\dojo\nexttick.ts:44:3>   @ command.target.(anonymous function) [as click]  <node_modules\leadfoot\comm and.js:674:11>   @ test.registersuite.iqc_homepage [as test]  <tests\functional\iqc_acceptance .js:44:7>   @ <node_modules\intern\lib\test.js:181:24>   @ <node_modules\intern\browser_modules\dojo\promise.ts:393:15>   @ runcallbacks  <node_modules\intern\browser_modules\dojo\promise.ts:11:11>   @ <node_modules\intern\browser_modules\dojo\promise.ts:317:4>   @ run  <node_modules\intern\browser_modules\dojo\promise.ts:237:7>   @ <node_modules\intern\browser_modules\dojo\nexttick.ts:44:3>   @ nexttickcallbackwith0args  <node.js:453:9>   @ process._tickcallback  <node.js:382:13> no unit test coverage chrome on platform 

need in figuring out issue. in advance!

here's suggestion:

.findbyxpath('id("settingsandlogout")/a[2]')         .getvisibletext()         .then(function(text){           console.log("the sign out link text :...", text.trim());           assert.strictequal(text.trim(), 'sign out', 'verify that, sign out link present.');         })       .end()       .findbyxpath('id("settingsandlogout")/a[2]')         .click()       .end() 

not elegant solution findbyxpath redundant. thing is, .click() expects previous command/element promise returns actual element when resolved (findbyxpath that).

hope helps!


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -