title: Using execute command in Page Objects in Nightwatch JS
body: <p>I have a problem with implementing Page Object in Nightwatch. Let's say that I have a login scenario. I need to scroll to the element - I'm using for thar execute function.</p>
  
  <pre><code>module.exports = {  
     'Login' : function (browser) {
      browser.url(this.launchUrl)
         .setValue('input[name=username]', 'admin')
         .setValue('input[name=password]', 'password')
         .execute(function () {
              document.querySelector('input[type=submit]').scrollIntoView();
          }, [])
         .click('input[type=submit]');
      browser.end();
      }
  }
  </code></pre>
  
  <p>I'd like to refactor this login code into Page Object like that </p>
  
  <pre><code>module.exports = {  
    url: function() {
      return this.api.launchUrl;
    },
    commands: [scrolling],
    elements: {
      usernameField: {
        selector: 'input[name=username]'
      },
      passwordField: {
        selector: 'input[name=password]'
      },
      submit: {
       selector: 'input[type=submit]'
    }
    }
  };
  </code></pre>
  
  <p>I'd like to 'hide' also this execute command and pack it into commands, like that:</p>
  
  <pre><code>var scrolling = {
    scroll: function(){
      return this.execute(function () {
        document.querySelector(input[type=submit]').scrollIntoView();
      }, []);
    }
  };
  </code></pre>
  
  <p>Unfortunately it seems that execute command doesn't work with Page Object.</p>
  
  <p>How I can overcome this issue with executing JavaScript code when I want to use Page  Object? How can I encapsulate it?</p>