drowranger
drowranger

Reputation: 11

Webdriver.io Scroll List

I use CodeceptJS with webdriver.io as helper to do e2e test for a website. There is a ul (unordered list) and I want to scroll down to this list. There is scroll bar and I used buttonDown and buttonUp methods on the scroll bar to perform but couldn't figure it out.

Thanks in advance.

Upvotes: 0

Views: 857

Answers (1)

LILBRICK1337
LILBRICK1337

Reputation: 76

To scroll down:

client
.url('https://www.yourwebsite.com')
.leftClick('#yourtable') // <-- should also work with .click()
.scroll(0, 500) // the higher the more we scroll

to use keys make sure to click on the list div box before that the emulated mouse is at the item you want to scroll down. Then you can press the down key to go down:

 /*
  \uE014    "ArrowRight"
  \uE015    "ArrowDown"
 */

client
.leftClick('#yourtable') // <-- should also work with .click()
.keys('ArrowDown')
.keys('ArrowDown')
.keys('ArrowDown')
// or
.keys('\uE015')
.keys('\uE015')
.keys('\uE015')

Source: api/protocol/keys.html

Upvotes: 1

Related Questions