undefined error in protractor on using a gettext() function and using it in other fileIs there a standard function to check for null, undefined, or blank variables in JavaScript?In Node.js, how do I “include” functions from my other files?How to getText on an input in protractorUsing angular functions ($q) in protractorConsole.log is executing before browser launches URLECONNREFUSED Webdriver errors in eclipse when running ProtractorAssertion not being called in Protractor codeProtractor - X is not a functionReturn a value from a promise within function to the test specProtractor's getText() method does not include text-transform done in a ::first-letter pseudoselector
Is it nonsense to say B -> [A -> B]?
The meaning of a て-form verb at the end of this sentence
How is CoreiX like Corei5, i7 is related to Haswell, Ivy Bridge?
Windows OS quantum vs. SQL OS Quantum
Is it bad writing or bad story telling if first person narrative contains more information than the narrator knows?
Has there been evidence of any other gods?
Two researchers want to work on the same extension to my paper. Who to help?
Peculiarities in low dimensions or low order or etc
How to make a language evolve quickly?
Is a vertical stabiliser needed for straight line flight in a glider?
Series that evaluates to different values upon changing order of summation
What food production methods would allow a metropolis like New York to become self sufficient
Improving Sati-Sampajañña (situative wisdom)
How to handle DM constantly stealing everything from sleeping characters?
How can I avoid subordinates and coworkers leaving work until the last minute, then having no time for revisions?
Why do protein solutions have to be alkalised?
How to evaluate sum with one million summands?
Why are parallelograms defined as quadrilaterals? What term would encompass polygons with greater than two parallel pairs?
Is this state of Earth possible, after humans left for a million years?
Is ‘despite that’ right?
Is there any evidence to support the claim that the United States was "suckered into WW1" by Zionists, made by Benjamin Freedman in his 1961 speech
Watching the game, having a puzzle
Are there non-military uses of 20%-enriched Uranium?
Was there a contingency plan in place if Little Boy failed to detonate?
undefined error in protractor on using a gettext() function and using it in other file
Is there a standard function to check for null, undefined, or blank variables in JavaScript?In Node.js, how do I “include” functions from my other files?How to getText on an input in protractorUsing angular functions ($q) in protractorConsole.log is executing before browser launches URLECONNREFUSED Webdriver errors in eclipse when running ProtractorAssertion not being called in Protractor codeProtractor - X is not a functionReturn a value from a promise within function to the test specProtractor's getText() method does not include text-transform done in a ::first-letter pseudoselector
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have written a utility function in InputBoxActions.js file for getting a text from the input field in protractor as as :
this.getTextFromInputBox = function (element)
if (typeof element !== 'undefined')
element.isDisplayed().then(function ()
element.isEnabled().then(function ()
element.getText().then(function(text)
return text;
)
);
);
;
However , on using the same function in the test spec file, i am getting the value of the text as undefined. Here i am calling the function as :
browserActions.goto(url);
var searchElement = findElements.byXpath("//input[@type='search']");
inputBoxActions.type(searchElement, 'angular');
var text = inputBoxActions.getTextFromInputBox(searchElement);
console.log(text);
Result i am getting is :
Started
undefined
(node:1412) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
.
1 spec, 0 failures
Finished in 6.082 seconds
javascript protractor angular-promise
add a comment |
I have written a utility function in InputBoxActions.js file for getting a text from the input field in protractor as as :
this.getTextFromInputBox = function (element)
if (typeof element !== 'undefined')
element.isDisplayed().then(function ()
element.isEnabled().then(function ()
element.getText().then(function(text)
return text;
)
);
);
;
However , on using the same function in the test spec file, i am getting the value of the text as undefined. Here i am calling the function as :
browserActions.goto(url);
var searchElement = findElements.byXpath("//input[@type='search']");
inputBoxActions.type(searchElement, 'angular');
var text = inputBoxActions.getTextFromInputBox(searchElement);
console.log(text);
Result i am getting is :
Started
undefined
(node:1412) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
.
1 spec, 0 failures
Finished in 6.082 seconds
javascript protractor angular-promise
add a comment |
I have written a utility function in InputBoxActions.js file for getting a text from the input field in protractor as as :
this.getTextFromInputBox = function (element)
if (typeof element !== 'undefined')
element.isDisplayed().then(function ()
element.isEnabled().then(function ()
element.getText().then(function(text)
return text;
)
);
);
;
However , on using the same function in the test spec file, i am getting the value of the text as undefined. Here i am calling the function as :
browserActions.goto(url);
var searchElement = findElements.byXpath("//input[@type='search']");
inputBoxActions.type(searchElement, 'angular');
var text = inputBoxActions.getTextFromInputBox(searchElement);
console.log(text);
Result i am getting is :
Started
undefined
(node:1412) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
.
1 spec, 0 failures
Finished in 6.082 seconds
javascript protractor angular-promise
I have written a utility function in InputBoxActions.js file for getting a text from the input field in protractor as as :
this.getTextFromInputBox = function (element)
if (typeof element !== 'undefined')
element.isDisplayed().then(function ()
element.isEnabled().then(function ()
element.getText().then(function(text)
return text;
)
);
);
;
However , on using the same function in the test spec file, i am getting the value of the text as undefined. Here i am calling the function as :
browserActions.goto(url);
var searchElement = findElements.byXpath("//input[@type='search']");
inputBoxActions.type(searchElement, 'angular');
var text = inputBoxActions.getTextFromInputBox(searchElement);
console.log(text);
Result i am getting is :
Started
undefined
(node:1412) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
.
1 spec, 0 failures
Finished in 6.082 seconds
javascript protractor angular-promise
javascript protractor angular-promise
asked Mar 23 at 10:05
ashish chauhanashish chauhan
327
327
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Your innermost return statement is only returning the value to the function that calls it and then unused.
-> element.getText().then(function(text)
return text;
);
You need to return all the nested then's like so if you want to achieve this in this way.
this.getTextFromInputBox = function (element)
if (typeof element !== 'undefined')
return element.isDisplayed().then(function ()
return element.isEnabled().then(function ()
return element.getText().then(function (text)
return text;
)
);
);
else
throw new Error(`$element is undefined`);
;
Imagine a line of guys who hand off some work to each other to complete. Your guy at the end is doing the work but not passing it back up the line to the boss where it is needed.
Hi , Thanks a lot for the help. its working now:)
– ashish chauhan
Mar 23 at 16:21
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55312608%2fundefined-error-in-protractor-on-using-a-gettext-function-and-using-it-in-othe%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your innermost return statement is only returning the value to the function that calls it and then unused.
-> element.getText().then(function(text)
return text;
);
You need to return all the nested then's like so if you want to achieve this in this way.
this.getTextFromInputBox = function (element)
if (typeof element !== 'undefined')
return element.isDisplayed().then(function ()
return element.isEnabled().then(function ()
return element.getText().then(function (text)
return text;
)
);
);
else
throw new Error(`$element is undefined`);
;
Imagine a line of guys who hand off some work to each other to complete. Your guy at the end is doing the work but not passing it back up the line to the boss where it is needed.
Hi , Thanks a lot for the help. its working now:)
– ashish chauhan
Mar 23 at 16:21
add a comment |
Your innermost return statement is only returning the value to the function that calls it and then unused.
-> element.getText().then(function(text)
return text;
);
You need to return all the nested then's like so if you want to achieve this in this way.
this.getTextFromInputBox = function (element)
if (typeof element !== 'undefined')
return element.isDisplayed().then(function ()
return element.isEnabled().then(function ()
return element.getText().then(function (text)
return text;
)
);
);
else
throw new Error(`$element is undefined`);
;
Imagine a line of guys who hand off some work to each other to complete. Your guy at the end is doing the work but not passing it back up the line to the boss where it is needed.
Hi , Thanks a lot for the help. its working now:)
– ashish chauhan
Mar 23 at 16:21
add a comment |
Your innermost return statement is only returning the value to the function that calls it and then unused.
-> element.getText().then(function(text)
return text;
);
You need to return all the nested then's like so if you want to achieve this in this way.
this.getTextFromInputBox = function (element)
if (typeof element !== 'undefined')
return element.isDisplayed().then(function ()
return element.isEnabled().then(function ()
return element.getText().then(function (text)
return text;
)
);
);
else
throw new Error(`$element is undefined`);
;
Imagine a line of guys who hand off some work to each other to complete. Your guy at the end is doing the work but not passing it back up the line to the boss where it is needed.
Your innermost return statement is only returning the value to the function that calls it and then unused.
-> element.getText().then(function(text)
return text;
);
You need to return all the nested then's like so if you want to achieve this in this way.
this.getTextFromInputBox = function (element)
if (typeof element !== 'undefined')
return element.isDisplayed().then(function ()
return element.isEnabled().then(function ()
return element.getText().then(function (text)
return text;
)
);
);
else
throw new Error(`$element is undefined`);
;
Imagine a line of guys who hand off some work to each other to complete. Your guy at the end is doing the work but not passing it back up the line to the boss where it is needed.
answered Mar 23 at 10:34
DublinDevDublinDev
1,2342320
1,2342320
Hi , Thanks a lot for the help. its working now:)
– ashish chauhan
Mar 23 at 16:21
add a comment |
Hi , Thanks a lot for the help. its working now:)
– ashish chauhan
Mar 23 at 16:21
Hi , Thanks a lot for the help. its working now:)
– ashish chauhan
Mar 23 at 16:21
Hi , Thanks a lot for the help. its working now:)
– ashish chauhan
Mar 23 at 16:21
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55312608%2fundefined-error-in-protractor-on-using-a-gettext-function-and-using-it-in-othe%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown