How to scroll webpage in automation tests with Mocha.js with TestMu AI cloud?

How to scroll webpage in automation tests with Mocha.js with TestMu AI cloud?

Hi Tom,

In order to scroll webpage in automation tests with Mocha.js on the TestMu AI cloud, you can refer to these following steps. You can also refer to the sample test repo:

To scroll down by x (in this case 350) pixels, you can use the following line of code:

driver.executeScript("window.scrollBy(0,350)", "");

To scroll up by x (in this case 350) pixels, you can use the following line of code:

driver.executeScript("window.scrollBy(0,-350)", "");

To scroll to the bottom of the page, you can use the following line of code:

driver.executeScript("window.scrollTo(0, document.body.scrollHeight);")