I am currently using nightwatch for end-to-end testing of my application. One of the tests is failing because it seems unable to scroll to the element that needs to be tested. I am wondering if scrolling is necessary, or if there is another workaround. Here is the code snippet for the element in question:
return this.waitForElementVisible('#myElement', 4000) //wait for it to be visible
.assert.visible('#myElement')
.click('#myElement')
The element being tested is located at the top of the page, but the test runner has scrolled down slightly and the element is not visible in the screenshot. How can I scroll to this element if necessary? Or is there an alternative way to test this element?