As I understood, window.scrollBy
function should be working as result of #282. Apparently, it is not the case when I tried it in my case to trigger some lazy load using v2.48.0:
try (final WebClient webClient = new WebClient(BrowserVersion.BEST_SUPPORTED)) {
HtmlPage htmlPage = webClient.getPage("https://www.tokopedia.com/p/handphone-tablet/handphone?page=1");
System.out.println(htmlPage.getByXPath("//div[@data-testid='lstCL2ProductList']/div").size());
htmlPage.executeJavaScript("window.scrollBy(0,2000);");
webClient.waitForBackgroundJavaScript(10_000);
System.out.println(htmlPage.getByXPath("//div[@data-testid='lstCL2ProductList']/div").size());
} catch (IOException e) {
}
The number of elements after scroll is the same as before.
What did I miss? Is the scroll functionality still not perfect?
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too