getText function returns undefined. Can someone please help me here

5,153 views
Skip to first unread message

santosh

unread,
Jan 11, 2016, 2:18:55 AM1/11/16
to NightwatchJs
Hi,
Accidentally i deleted other post with same subject. So here is my question"

Lately, I have been doing POC using nightwatch js and I have been running into some issues while returning the getMethod's text value to my test. I always get "undefined" as a value in my test.but when i debug i can see the value in the method.

 i had tried reading other posts regarding same problem but no luck. Can someone please help to resolve this?

I am following the page object design pattern as per nightwatch js and am having the method inside page.js file.

demopage.js

var demoServicesFunctions={

getDemoTabText:function(){
var fieldVal;
this.getText('@demoTab', function(result){
fieldVal=result.value;
fieldVal=fieldVal.trim();
});
return fieldVal;
}
}
module.exports={

commands:[demoServicesFunctions],
elements:{
demoTab:{
selector:"//a/span[text()='demo']",
    locateStrategy:"xpath"

},
}

};

demotest.js


var demoServicesPage;
module.exports={
    before: function(browser){
    browser.url(browser.launch_url);
browser.pause(2000);
demoServicesPage=browser.page.demopage();

},
   after : function(browser){
    browser.end();
},


"Verify Demo services : function(client) {

var textVal=demoServicesPage.getDemoTabText();

console.log("The text is :"+textVal); //the textVal is always showing as undefined.


}
}

}

Thanks,
Santosh

santosh

unread,
Jan 11, 2016, 1:08:45 PM1/11/16
to NightwatchJs
Can someone please give me any hints on this?  I am stuck with this.

Thanks,
Santosh

santosh

unread,
Jan 11, 2016, 3:01:10 PM1/11/16
to NightwatchJs
Thanks! i figured it out using Promise npm. I am bit new to JS as well, so I am having a bit hard time to get through this.  I would encourage the experts here, to advise the beginners like me for any queries posted.

Stephanie Madison

unread,
Jan 11, 2016, 4:38:50 PM1/11/16
to nightw...@googlegroups.com
Glad you got it figured out. Since you said you're new to Javascript I'd suggest checking out some examples that are similar to yours:

--
You received this message because you are subscribed to the Google Groups "NightwatchJs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nightwatchjs...@googlegroups.com.
To post to this group, send email to nightw...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/4947a429-d811-46e4-8c6f-1e5dd440b42b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

santosh

unread,
Jan 11, 2016, 7:51:06 PM1/11/16
to NightwatchJs
Thank you. 

Gomathi Balan

unread,
Mar 2, 2017, 11:24:35 AM3/2/17
to NightwatchJs

Hi Santosh,

We have tried the logic to get the text value from the page using the NightWatch getText() method but unable to implement. After lot of search , we found your post which is very helpful about what to do and we are lacking with implementation. 

We have the code logic like how you have done. Please help us to implement the logic by using the below mentioned code. It would be very helpful if explain using promise logic.
Regards,
Gomathi

Eric Mumford

unread,
Mar 2, 2017, 10:43:16 PM3/2/17
to NightwatchJs
It would be more helpful if you stated your specific goal and code you've tried that illustrates your attempt that we can look at.

Gomathi Balan

unread,
Mar 3, 2017, 2:06:14 AM3/3/17
to nightw...@googlegroups.com
Thanks for the reply Eric.

I have tried like below and whenever i execute the below set of code i am receiving the exception.Please help me to resolve. I am new to node js and nightwatch. Awaiting for your reply. Thanks in advance.

Exception:

Running:  Demo Google search test using page objects
verifying the getText functionality
Promise {
  _45: 0,
  _81: 2,
  _65:
   TypeError: self.getText is not a function
       at D:\Automation\utilities\utils.js:19:14
       at tryCallTwo (D:\Automation\node_modules\promise\lib\core.js:45:5)
       at doResolve (D:\Automation\node_modules\promise\lib\core.js:200:13)
       at new Promise (D:\Automation\node_modules\promise\lib\core.js:66:3)
       at Object.getTextFromPage (D:\Automation\utilities\utils.js:17:12)
       at Object.Demo Google search test using page objects (D:\Automation\tests
\googleSearchTestPage.js:16:33)
       at Module.call (D:\Automation\lib\nightwatch\lib\runner\module.js:62:34)
       at D:\Automation\lib\nightwatch\lib\runner\testcase.js:70:29
       at _fulfilled (D:\Automation\lib\nightwatch\node_modules\q\q.js:834:54)
       at self.promiseDispatch.done (D:\Automation\lib\nightwatch\node_modules\q
\q.js:863:30),
  _54: null }

getText Promise function:

var Promise = require('promise');
var getTextFromPage = function(element){
    var self = this;
    return new Promise(function(resolve,reject){
        console.log("verifying the getText functionality");
        self.getText(element,function(result){
          console.log("Now in getText function");
          resolve(result.value);
           fieldVal=result.value;
        });
    });
};
module.exports.getTextFromPage = getTextFromPage;


PageOject Js File:

var util = require('util');

var searchmenuXpath = '//li[contains(@class,"tabs_item")][contains(., %s)]';
var menuCommands = {
  productIsSelected: function(product, callback) {
    var self = this;
    return this.getAttribute(product, 'class', function(result) {
      var isSelected = result.value.indexOf('tabs_web') > -1;
      callback.call(self, isSelected);
     });
  }
};

module.exports = {
  elements: {
    results: { selector: '#web-results' },
    textverify: { selector:'.results-num'},
  },
  sections: {
    menu: {
      selector: '.tabs',
      commands: [menuCommands],
      elements: {
        web : { selector: util.format(searchmenuXpath, 'Web'), locateStrategy: 'xpath' },
        support : { selector: util.format(searchmenuXpath, 'Support'), locateStrategy: 'xpath' },
        images : { selector: util.format(searchmenuXpath, 'Images'), locateStrategy: 'xpath' }
      }
    }
  }
};

Test.js:

var util_functions = require("../utilities/utils");
var Promise = require('promise');

module.exports = {
  'Demo Google search test using page objects' : function (client) {
    var homePage = client.page.googleSearchPageObj();
    homePage.navigate();
    homePage.expect.element('@searchBar').to.be.enabled;
    homePage
      .setValue('@searchBar', 'Flowers')
      .submit();
       var resultsPage = client.page.searchResultsDemo();
       resultsPage.expect.element('@results').to.be.present.after(10000);
      //  resultsPage.expect.element('@results').text.to.equal("Flowers");
      fieldVal = util_functions.getTextFromPage1('@textverify');
      console.log(fieldVal);

       resultsPage.expect.section('@menu').to.be.visible;

       var menuSection = resultsPage.section.menu;
       menuSection.expect.element('@web').to.be.visible;
       menuSection.expect.element('@support').to.be.visible;
       menuSection.expect.element('@images').to.be.visible;

       menuSection.productIsSelected('@web', function(result) {
         this.assert.ok(result, 'Web results are shown by default on search results page');
   });
    client.end();
  }
};


--
You received this message because you are subscribed to a topic in the Google Groups "NightwatchJs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nightwatchjs/iUDgdCjD1CU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nightwatchjs+unsubscribe@googlegroups.com.

To post to this group, send email to nightw...@googlegroups.com.

Eric Mumford

unread,
Mar 3, 2017, 10:29:33 AM3/3/17
to nightw...@googlegroups.com
Hi Gomathi,

My initial reaction is that you are using a battleship to solve a rowboat problem.

Reading through your code, it looks like you just want to check the search result and some page elements after typing Flowers. Is that correct?

Why not just keep it as simple as possible:

module.exports = {

  'Demo Google search test without promises' : function (client) {

    var homePage = client.page.googleSearchPageObj();

    homePage

    .navigate()

    .waitForElementVisible('@searchBar',5000)

    .waitForElementVisible(‘@submit_button’,1000)

    .setValue('@searchBar', 'Flowers')

    .click(‘@submit_button’)

    .waitForElementVisible(‘@results’,5000)

    .waitForElementVisible(‘@web’,1000)

    .waitForElementVisible(‘@support’,1000)

    .waitForElementVisible(‘@images’,1000)

    .verify.textContains(‘@results’,’Flowers’);

 

    client.end();

  }

};


Gomathi Balan

unread,
Mar 6, 2017, 11:01:13 AM3/6/17
to nightw...@googlegroups.com
Thanks for your reply Eric!

The above method is working fine now and  I am able to verify the text present in the web page.
But I need to get the text from web the page and print it in the command prompt. How can I proceed the above method. 

Note: Already I am using the below method to get the text from the page. But I want to use the getText() method in the Page Object Model.

      .getText('//*[@id="sidebar-wrapper"]/div[4]/div/div[1]',function (result){
console.log(result.value);


Thanks,
Gomathi

Eric Mumford

unread,
Mar 6, 2017, 11:18:53 AM3/6/17
to nightw...@googlegroups.com
Hi Gomathi,

I would suggest adding console.log statements throughout your code to output your objects to see if they contain the values you think they do as your code is running. 

Most often when debugging NodeJS code, I find that I have written code with synchronous execution in mind and I have made an error in my logic as it runs asynchronously, or I have misunderstood the data structure that a method returns.

Good luck,
Eric

Sandeep Thukral

unread,
Mar 8, 2017, 11:50:17 AM3/8/17
to NightwatchJs
Santosh,

Do you have an example of how you solved your problem using promise npm? This would help beginners like me.

Steve F

unread,
Mar 28, 2017, 7:58:32 PM3/28/17
to NightwatchJs
I am also interested in some implementation specific details here.  I am used to working in C#, where you can just say "var elementText = element.getText()"  and return that from a method in your page object to your test.  

myPage.js contains this code:

module.exports = {
    elements: {
        myElement: { selector:'div.myElementSelector' }
    },
    commands: {
        getElementTextFromPage: function() {
            return this.waitForElementPresent('@myElement')
                .getText('@myElement'function(result){
                    return result.value;
                });
        }
    }
};

myTest.js has this code:

var pageUnderTest;

module.exports = {
    'tags': ['experiment'],
    before: function(client) {
        //stuff to initialize page
        pageUnderTest = client.page.myPage();
    },
     after: client => client.end(),
    'Get value from page': (client=> {
        var textToUse = pageUnderTest.getElementTextFromPage();

        pageUnderTest.NavigateToAnotherPage();
        var anotherTestedPage = client.page.anotherPage();
        anotherTestedPage.containsText(textToUse);

  }
};


I hope it makes sense what I am trying to do, which is to implement the getElementTextFromPage command in a way that allows me to use the text later in my test.  I don't know what it is I'm not wrapping my head around, but I feel like it should be incredibly simple to do this.

Eric Mumford

unread,
Mar 28, 2017, 10:06:25 PM3/28/17
to nightw...@googlegroups.com
Steve, look at the perform() method here: https://github.com/nightwatchjs/nightwatch/issues/1055

--
You received this message because you are subscribed to a topic in the Google Groups "NightwatchJs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nightwatchjs/iUDgdCjD1CU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nightwatchjs+unsubscribe@googlegroups.com.
To post to this group, send email to nightw...@googlegroups.com.

Steve F

unread,
Mar 29, 2017, 1:32:41 AM3/29/17
to NightwatchJs, eric.m...@gmail.com
Eric,  are you saying I could run perform(client, done) {...} inside the command so that the command will return the value rather than undefined?  I really want to avoid referring to page elements from inside the test cases, and I need to follow a page object model pattern. (I'm testing a really big site, and maintaining element references from within test cases would be a nightmare.


To unsubscribe from this group and all its topics, send an email to nightwatchjs...@googlegroups.com.

To post to this group, send email to nightw...@googlegroups.com.

Steve F

unread,
Mar 30, 2017, 8:11:20 PM3/30/17
to NightwatchJs, eric.m...@gmail.com
So, after digging into this issue a little more, I found that the perform method is not a good candidate because I want to keep all page object references inside the page object.

I did have a mental breakthrough, where I figured out how to do this by using a callback method and chaining to force synchronous execution.  Here is an example of what I did:

first, in my page object, I defined a getElementTextFromPage(callback) function, that just passes the value of the element to the callback method.  In the real world, I did a little manipulating of result.value before passing it along, but I pulled that out from this example to help simplify things.  Also, on a slightly unrelated topic, I added a navigateToAnotherPage() function to allow me to chain the commands to compare the value from myPage with anotherPage within the test file.  Here is my example code:
module.exports = {
    elements
: {
        myElement
: 'div.myElementSelector',
        linkToAnotherPage
: 'a.linkToAnotherPage'        
   
},
    commands
: {
        getElementTextFromPage
: function(callback) {

           
return this.waitForElementPresent('@myElement')
               
.getText('@myElement', function(result){

                    callback
(result.value);
               
});
       
},
        navigateToAnotherPage
: function() {
           
this.getAttribute("@lintToAnotherPage", "href", function (link) {
               
this.url(link.value);
           
});
           
return this.api.page.anotherPage();

       
}
   
}
};

From here, for my test code looks like this:

var pageUnderTest;

module.exports = {
   
'tags': ['experiment'],
    before
: function(client) {
       
//stuff to initialize page
        pageUnderTest
= client.page.myPage();
   
},
     after
: client => client.end(),
   
'Get value from page': (client) => {

       
var textToUse;
        pageUnderTest
           
.getElementTextFromPage(function(textFromPage) {
                textToUse
= textFromPage;
           
})
           
.NavigateToAnotherPage()
           
.containsText(textToUse); // command exists within page object for anotherPage.js

 
}
};

You might notice that the browser state is modified by this test, so it would be useful to run beforeEach rather than before to load the desired page if the file contains more than one test.  For me, one thing that was hard to accept is the requirement to chain the test steps to in nightwatch, which I hear that some JS frameworks like testCafe don't force you to do; however, I am adding to an existing framework, so it isn't worth moving.

Gomathi Balan

unread,
May 15, 2017, 10:56:00 AM5/15/17
to nightw...@googlegroups.com
Hi,

I am getting my HTML report in the below format after my script execution. Is there is anyway to change the format to print the element name instead CSS selector  or xpath.

Note: I am using handlebars to change the XML output to HTML report format.

footertest

Validate footersection from Xfinity SearchResults Page

  •  Element <input[id="q"]> was visible after 4023 milliseconds.
  •  Element <button[id=search-submit]> was visible after 85 milliseconds.
  •  Testing if element <//ul[@class="footer-nav"]/li[1]> contains text: "2017 Interactive Media".

Thanks,
Gomathi.

To unsubscribe from this group and all its topics, send an email to nightwatchjs+unsubscribe@googlegroups.com.

To post to this group, send email to nightw...@googlegroups.com.

Dan Caseley

unread,
May 15, 2017, 11:36:09 AM5/15/17
to NightwatchJs
You haven't provided code, and I can't tell from the above what you've done.
Assuming you're using containsText(), there's a custom message you can pass in to get printed - it's the 3rd parameter.

Gomathi Balan

unread,
May 16, 2017, 6:18:26 AM5/16/17
to nightw...@googlegroups.com
Hi Dan,

I am using below html code to convert nightwatch XML report to HTML report.


.hbs file:

<!DOCTYPE html>
<html>
<head>
  <title>Test Results - {{browser}}</title>

  <style>
    html, body {
      font-family: Arial,sans-serif;
      margin: 0;
      padding: 0;
    }
    body { padding: 10px 40px; }
    header { position: relative; }
    #expand-collapse-all {
      position: absolute;
      bottom: -25px;
      right: 0;
      padding: 3px 6px;
      border-radius: 4px;
      background-color: #000;
      font-size: 0.8em;
      color: #fff;
      cursor: pointer;
    }
    table { width: 100%; margin-bottom: 20px; }
      td {
        padding: 7px;
        border-top: none;
        border-left: 1px black solid;
        border-bottom: 1px black solid;
        border-right: none;
      }
      td.pass { color: #003b07; background: #86e191; }
      td.skip { color: #7d3a00; background: #ffd24a; }
      td.fail { color: #5e0e00; background: #ff9c8a; }
    tr:last-child       { border-top: 1px black solid; }
      tr:last-child td    { border-top: 1px black solid; }
      tr:first-child td   { border-top: 1px black solid; }
        td:last-child       { border-right: 1px black solid; }
    tr.overview td      { padding-bottom: 0px; border-bottom: none; }
    tr.overview.last td { padding-bottom: 3px; }
    .suite { cursor: pointer; }
      .suite > .toggle-assertions { display: none; font-weight: normal; margin-left: 2px; }
    ul.assertions     { list-style-type: none; }
      span.error      { color: #AD2B2B; }
      span.success    { color: #53891E; }
    .stacktrace { display: inline; }
      .stacktrace code { display: none; }
    #nightwatch-logo {
      position: absolute;
      top: 20px;
      right: 33px;
      width: 70px;
      height: 75px;
      background: transparent url('http://nightwatchjs.org/img/logo-nightwatch.png') no-repeat;
      background-size: 70px 75px;
    }
  </style>
</head>

<body>
  <h1>Test Results</h1>

  <header>
    <table border="0" cellpadding="0" cellspacing="0">
      <tr class="overview">
        <td colspan="3" title="{{browser}}"><strong>Browser:</strong> {{browser}}</td>
      </tr>
      <tr class="overview">
        <td colspan="3"><strong>Timestamp:</strong> {{timestamp}}</td>
      </tr>
      <tr class="overview last">
        <td colspan="3"><strong>Tests:</strong> {{results.tests}}<br></td>
      </tr>
      <tr>
        <td class="pass"><strong>{{results.passed}}</strong> passed</td>
        <td class="skip"><strong>{{results.errors}}</strong> errors</td>
        <td class="fail"><strong>{{results.failed}}</strong> failures</td>
      </tr>
    </table>

    <div id="controls">
      <div id="expand-collapse-all">toggle asssertions</div>
    </div>
  </header>

  {{#each results.modules}}
      <h2>{{@key}}</h2>

      {{#each this.completed}}
        <h3 class="suite">{{@key}} <span class="toggle-assertions"></span></h3>

        <ul class="assertions">
          {{#each this.assertions}}
            <li>
              {{#if failure}}
                <span class="error">&#10006;</span>
              {{else}}
                <span class="success">&#10004;</span>
              {{/if}}

              {{this.message}}

              {{#if this.failure}}
                {{this.failure}}
              {{/if}}

              {{#if this.stacktrace}}
                <div class="stacktrace">
                    <a href="#">view stacktrace</a>
                    <code><pre>{{this.stacktrace}}</pre></code>
                </div>
              {{/if}}
            </li>
          {{/each}}
        </ul>

        <p>
          {{#if this.failed}}
            <span class="error"><strong>FAILED:</strong></span>
            <span class="error"><strong>{{this.failed}}</strong></span> assertions failed and
            <span class="success"><strong>{{this.passed}}</span></strong> passed. ({{this.time}}s)
          {{else}}
            <span class="success"><strong>OK.</strong></span>
            <span class="success"><strong>{{this.passed}}</strong></span> assertions passed. ({{this.time}}s)
          {{/if}}
        </p>
      {{/each}}

      {{#if this.skipped}}
        <h4>skipped</h4>
        <ul>
          {{#each this.skipped}}
            <li>{{this}}</li>
          {{/each}}
        </ul>
      {{/if}}

      <hr>
  {{/each}}

  <div id="nightwatch-logo"></div>

  <script>
  $(function() {
    $('div.stacktrace').on('click', 'a', function(evt) {
      evt.preventDefault();
      var $link = $(this);
      var $code = $link.parent().find('code');
      $code.toggle();
      $code.is(':visible') ? $link.text('hide stacktrace'):
                             $link.text('view stacktrace');
    });
    $('h3.suite')
      .on({
          click: function(evt) {
            $(this).next('ul.assertions').toggle();
            toggleAssertions(this);
          },
          mouseenter: function(evt) {
            toggleAssertions(this);
            $(this).find('span.toggle-assertions').show();
          },
          mouseleave: function(evt) {
            $(this).find('span.toggle-assertions').hide();
          }
      });
    function toggleAssertions(element) {
      if ( $(element).next('ul.assertions').is(':visible') ) {
        $(element).find('span.toggle-assertions').text('-');
      } else {
        $(element).find('span.toggle-assertions').text('+');
      }
    }
    $('#expand-collapse-all').on('click', function(evt) {
      $('ul.assertions').toggle();
    });
   if ( $(document).height() > $(window).height()) {
     $('ul.assertions').hide();
   }
  });
  </script>
</body>
</html>




.js file:
 

var fs = require('fs');
var path = require('path');
var handlebars = require('handlebars');

module.exports = {
  write : function(results, options, done) {

    var reportFilename = options.filename_prefix + (Math.floor(Date.now() / 1000)) + '.html';
    var reportFilePath = path.join(__dirname, options.output_folder, reportFilename);

    // read the html template
    fs.readFile('html-reporter.hbs', function(err, data) {
      if (err) throw err;
      var template = data.toString();
      //console.log(data.toString());

      // merge the template with the test results data
      var html = handlebars.compile(template)({
        results   : results,
        options   : options,
        timestamp : new Date().toString(),
        browser   : options.filename_prefix.split('_').join(' ')
      });

      // write the html to a file
      fs.writeFile(reportFilePath, html, function(err) {
        if (err) throw err;
        console.log('Report generated: ' + reportFilePath);
        done();
      });
    });
  }
};



HTML report format:

footertest

Validate footersection from Xfinity SearchResults Page

  •  Element <input[id="q"]> was visible after 4023 milliseconds.
  •  Element <button[id=search-submit]> was visible after 85 milliseconds.
  • ✔ Element <//ul[@class="footer-nav"]/li[1]> was visible after 58 milliseconds.
  •  Testing if element <//ul[@class="footer-nav"]/li[2]/a> contains text: "Privacy Statement".
  •  Element <//ul[@class="footer-nav"]/li[2]/a> was visible after 252 milliseconds.
  •  Testing if element <//ul[@class="footer-nav"]/li[3]/a> contains text: "Acceptable Use Policy".
  •  Element <//ul[@class="footer-nav"]/li[3]/a> was visible after 51 milliseconds.
  •  Testing if element <//ul[@class="footer-nav"]/li[4]/a> contains text: "Terms of Service".
  •  Element <//ul[@class="footer-nav"]/li[4]/a> was visible after 40 milliseconds.
  •  Testing if element <//ul[@class="footer-nav"]/li[5]/a> contains text: "Advertise With Us".
  •  Element <//ul[@class="footer-nav"]/li[5]/a> was visible after 41 milliseconds.
  •  Testing if element <//ul[@class="footer-nav"]/li[6]/a> contains text: "Feedback".
  •  Element <//ul[@class="footer-nav"]/li[6]/a> was visible after 43 milliseconds.

OK. 14 assertions passed. (108.4s)




so the highlighted section in the HTML report  i want to print the element name ( search button) instead of selector name( <input[id="q"]> ). Please let me know is there is anyway to change the format in the reporting code.


Thanks,
Gomathi
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

As i am getting the below HTML report with 

To unsubscribe from this group and all its topics, send an email to nightwatchjs+unsubscribe@googlegroups.com.

To post to this group, send email to nightw...@googlegroups.com.

Dan Caseley

unread,
May 16, 2017, 8:10:53 AM5/16/17
to NightwatchJs
This looks like rarcega's custom HTML reporter here
I'm suggesting that the easiest method is to alter your nightwatch test so that the text being processed in handlebars already has your domain-specific rather than DOM-specific text.

For the highlighted instance, where your test currently contains 
waitForElementVisible('<input[id="q"]>',5000)

have instead 
waitForElementVisible('<input[id="q"]>',5000,'Search button was visible in less than 5 seconds').


If you wanted to add more info into that, you could look at how the formatting is performed in the Nightwatch source here: https://github.com/nightwatchjs/nightwatch/blob/master/lib/api/element-commands/_waitForElement.js#L256
This says you've got the selector and the time available, so you could, instead, do this:
waitForElementVisible('<input[id="q"]>',5000,'Search button was found using selector %s and was visible in %d milliseconds').

HTH,

Dan

Eric Mumford

unread,
May 17, 2017, 7:54:11 AM5/17/17
to nightw...@googlegroups.com
Please don't hijack old posts with new questions. Start a new thread, and if you can provide code you have attempted.

To unsubscribe from this group and all its topics, send an email to nightwatchjs+unsubscribe@googlegroups.com.

To post to this group, send email to nightw...@googlegroups.com.

Gomathi Balan

unread,
May 18, 2017, 7:24:49 AM5/18/17
to nightw...@googlegroups.com
Thanks for your support Dan !

To unsubscribe from this group and all its topics, send an email to nightwatchjs+unsubscribe@googlegroups.com.

To post to this group, send email to nightw...@googlegroups.com.

Gomathi Balan

unread,
May 18, 2017, 7:25:28 AM5/18/17
to nightw...@googlegroups.com

RamaKrishna Bandaru

unread,
Mar 28, 2019, 1:27:35 AM3/28/19
to NightwatchJs
Hi one and all..
i'm Ramakrishna....i'm getting the problem for get the text of the webelement please hlep me to get out this problem......
i'm trying this way..
browser.getText(locators.expectedYearSelector,function(result)
{
var ActualYear=result.value;
console.log(ActualYear);
})
console.log(ActualYear)

i'm unable to use the ActualYear variable out of the getText method loop......please guide me how i can solve this...........
Reply all
Reply to author
Forward
0 new messages