scrollTo(driver, xPixels, yPixels)
scrollTo
Parameters:
Name | Type | Description |
---|---|---|
driver |
Object |
webdriver object of web browser. |
xPixels |
Number |
to how much you want to scroll down/up from initial position. |
yPixels |
Number |
to how much you want to scroll leftr/right from initial position. |
Example
Examples usage of scrollTo
scrollTo(driver, xPixels, yPixels).then(() => {
// It will scroll down/up to the pixels user give from the initial position.
// It will scroll left/right to the pixels user give from the initial position.
// To scroll up/right you have to give pixels in negative.
}).catch((error) => {
// handle error
});