how to scroll down the browser window

6,187 views
Skip to first unread message

Vivian Ho

unread,
Oct 25, 2014, 12:43:48 AM10/25/14
to nightw...@googlegroups.com
Is there a way to scroll down the window in Nightwatch?  Thanks for your answer.

Vivian Ho

unread,
Oct 27, 2014, 11:29:02 AM10/27/14
to nightw...@googlegroups.com
This is fixed now, used browser
        browser.execute('scrollTo(0,3000)');

Lacy Morrow

unread,
Oct 27, 2014, 4:09:53 PM10/27/14
to nightw...@googlegroups.com
^This is the best method of scrolling at this time to my knowledge. 

By default selenium scrolls to an element (element to top of screen) before interacting (won't interact with elements not visible). You can change the behavior to scroll the element to the bottom of the page, but for arbitrary scrolls you must use javascript for now

Rohit Singh

unread,
Oct 13, 2015, 2:22:45 AM10/13/15
to NightwatchJs, lacy....@invitae.com
Can we also scroll on a particular Div? Please help.

Rohit Singh

unread,
Oct 13, 2015, 2:23:05 AM10/13/15
to NightwatchJs
Can we also scroll on a particular Div? Please help.

Kuba Mucha

unread,
Oct 14, 2015, 8:19:05 AM10/14/15
to NightwatchJs

Paul Levesque

unread,
Sep 7, 2016, 10:03:57 AM9/7/16
to NightwatchJs
Hi, 

You can use this, working for me:

browser.getLocationInView("<your selector>", 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);
});

Thanks

Pushkala Puranam

unread,
Jan 10, 2018, 12:41:24 PM1/10/18
to NightwatchJs
This function is not working for me :

 browser.execute('scrollTo(0,3000)');

I tried :
.waitforelementvisible ('css path')
 browser.execute('scrollTo(0,3000)');
Reply all
Reply to author
Forward
0 new messages