theintern / leadfoot

A JavaScript client library that brings cross-platform consistency to the Selenium WebDriver API.
Other
170 stars 24 forks source link

Scroll item into view #107

Closed jimothyhalpert7 closed 4 years ago

jimothyhalpert7 commented 7 years ago

We have a growing list, and we want to get the total number of items in it.

Only a portion of the items are rendered, and you have to scroll to the end of it to load more. Looking for a way to load all the items, and then get the total number. We tried findDisplayed on the last list item. It finds the item, but it doesn't scroll that item into view, so growing isn't triggered. Adding click() does scroll it into view and triggers growing, but then we have to navigate back.

Looking for advice for a cleaner solution. Thanks.

kimek commented 7 years ago

Did you use pollUntil or sleeep with findDisplayed{....} ?

pollUntil example -> https://gist.github.com/lawnsea/1da6ab02bd9b0a8f7b3b sleep -> https://theintern.github.io/leadfoot/module-leadfoot_Command.html#sleep findDisplayed -> docs : https://theintern.github.io/leadfoot/module-leadfoot_Command.html#findDisplayed commit/issue : https://github.com/theintern/leadfoot/issues/15

Also this can be helpful. https://mmxgroup.net/category/testing/

You should scroll -> sleep -> findDisplayed ?

jason0x43 commented 7 years ago

@jimothyhalpert7 What do you mean by 'navigate back'?

jimothyhalpert7 commented 7 years ago

@jason0x43 by clicking an item we proceed to the details page. To get back to the list, we need to navigate back, away from it. Since we clicked that item just before, it is now visible.

jason0x43 commented 7 years ago

Try moveMouseTo instead of click. It will also scroll, but without causing an action.

jason0x43 commented 4 years ago

Closing due to inactivity, and because this seems to be working