nightwatch.js - scroll until element is visible
<p>I want to scroll page until desired element appear visible. </p>

<p>I have tried:</p>

<pre><code>    browser.execute(function () {
        window.scrollBy(0, 10000000);
    }, []);
</code></pre>

<p>and </p>

<pre><code>browser.getLocationInView("&lt;selector&gt;", function(result) {
    this.assert.equal(typeof result, "object");
    this.assert.equal(result.status, 0);
    this.assert.equal(result.value.x, 200);
    this.assert.equal(result.value.y, 200);
});
</code></pre>

<p>First do not scroll page and second fails because element is not visible.</p>

<p>How to fix this? I want to scroll till element appear visible.</p>