Hi Josh,
As an aside - That sounds like its worthy of a defect for bad UX design, as you should not need to scroll through more than 1-2 pages of menu items to find anything. (I know this doesn’t help solve the issue, but it’s a suggestion to discuss with your team)
Now assuming the menu item you want to click looks something like:
<div class=“v-virtual-scroll__item” style="top: 123px;">
<a href="/page/to/open">
<img src="/path/to/icon"/>
<span>Click This One</span>
</a>
</div>
Q1) Is if there is scroll elements in the menu?
- up and down arrows at the top and bottom of the menu?
- a more item in the menu you can click for the next page?
- something else?
The best way to handle this is with several keywords, one to open the menu, one to go next page on the menu, one to scroll till you find the menu item and then a main one to navigate to the menu item that you call from your test cases, something like this:
*** Test Cases ***
Open My Menu Item
Nav To Menu Item Click This One
*** Keywords ***
Nav To Menu Item
[Arguments] ${MenuText}
Open Menu
Scroll Item to View ${MenuText}
Click Element //div[@class="v-virtual-scroll__item"]//span[text()="${MenuText}"]
Open Menu
# I guess you have the code to do this bit
Scroll Menu
# do something to scroll the menu down 1 page
# Hopefully you have already worked this out otherwise see Q1
Scroll Item to View
[Arguments] ${MenuText}
Scroll Menu
${passed}= Run Keyword And Return Status Page Should Contain Element //div[@class="v-virtual-scroll__item"]//span[text()="${MenuText}"]
IF not ${passed}
Scroll Item to View ${MenuText}
END
You’ll notice Scroll Item to View
calls itself, this is intentional but can result in scrolling forever if the menu item is not found, so you might want to put in a way to detect if you reached the end of the menu and make Scroll Menu
fail if that happens.
Hopefully that will help,
Dave.