Hello guys,
I have a problem finding a way to solve, in my project on a page is present virtual scroll, because of that I can get all the elements and their text.
I need a solution to find that will scroll down the current list until the next loaded elements will contain the needed element with the needed text/title will be visible.
This page allows finding only 10 elements, each scroll will eliminate the elements opposite to the direction of scrolling.
I’m trying also to find a way based on “Execute Javascript”, but currently I’m not so experienced to work with that approach.
Help me please, or give some tips to know where can I find the solution.
Have a great day!
Just if someone will read this post.
In case of virtual scroll and lazy load, that load only 9 elements and no more, I found such a way that works perfectly:
Scroll in page for needed name
[Arguments] ${name}
Click Element xpath=//cdk-virtual-scroll-viewport
FOR ${scroll_index} IN RANGE 100
Set Browser Implicit Wait 0.01
${is_card_found}= Run Keyword And Return Status Element Should Be Visible xpath=//card[contains(., “${name}”)]
Run Keyword If ‘${is_card_found}’==‘True’ Exit For Loop
Press Keys NONE ‘\ue00f’
END
Here “Press Keys NONE ‘\ue00f’” the code if for clicking the page down. Such approach also works if you’ll click on arrow_down/up
The first step of clicking, is to focus on the virtual-scroll global page element, because in other cases the page do no scroll down because of the fixed menus
Just an FYI
From the documentation for Press Keys you can find a link to Selenium Keys, which tells you
PAGE_DOWN
*= ‘\ue00f’
so you should be able to replace
Press Keys NONE ‘\ue00f’
with
Press Keys NONE PAGE_DOWN
Dave.
The problem is that I’ve tried to use PAGE_DOWN, but, keyword ran successfully but page/element is not scrolled
vin., 28 iul. 2023, 19:12 Dave via Robot Framework <notifications@robotframework1.discoursemail.com> a scris:
I’ll admit I’ve not used the Page Down key in my scripts, but the other key names have worked for me, perhaps you found a bug?
Dave.
That may be related to the page, cdk-virtual-scroll and the lazy load.
I need to try on other pages and investigate if it is a bug with Robot or not.
sâm., 29 iul. 2023, 03:57 Dave via Robot Framework <notifications@robotframework1.discoursemail.com> a scris:
My guess (and it’s just a guess) is it’s more likely a bug with SeleniumLibrary than Robot
Dave.
I’ll do some research next week. In case it’s a bug, where I should I report it?
sâm., 29 iul. 2023, 13:22 Dave via Robot Framework <notifications@robotframework1.discoursemail.com> a scris: