Created
November 26, 2015 14:25
Revisions
-
SimitTomar created this gist
Nov 26, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ @christian-bromann My question is around the Custom Commands. I went through the example given here: http://webdriver.io/guide/usage/customcommands.html Based on that created to JS files 1) getUrlAndTitle.js: which contains the code for custom command: client.addCommand("getUrlAndTitle", function(customVar, cb) { this.url(function(err,urlResult) { this.getTitle(function(err,titleResult) { var specialResult = {url: urlResult.value, title: titleResult}; cb(err,specialResult); console.log(customVar); // "a custom variable" }) }); }); 2) Test.js: which contains the step Definitions: this.Then(/^I Select an appropriate Title$/, {timeout: 30 * 1000}, function (next) { this.client .init() .getUrlAndTitle('a custom variable',function(err,result){ console.log('entered getUrlAndTitle'); }) .then(function() { this.call(next); }); }); But the Issue is that I am not getting .getUrlAndTitle as a command when I do this.client. , I just typed it manually in the step definition to see the output. Of course, the corresponding step is failing. Is there anything that I am missing here, do I need to add the path of getUrlAndTitle.js in Test.js like var getUrlAndTitle = require('tests/acceptance/wdio/utilities/helper/getUrlAndTitle.js'); or add the command in world.js Please suggest