Skip to content

Scroll event to get pagination progress #282

@kronos72it

Description

@kronos72it

I successfull done login with HtmlUnit on SITE, run a form search and got a page with results. Now in real world, to get the whole page result I need to scroll the page more times . But I am using HtmlUnit ,then I have done :

List

res=page.getByXPath(...) // got 13 items
ScriptResult res=page.executeJavaScript("window.scrollBy (0,2000);");
res=page.getByXPath(...) // would get more items than 13 items

But the 2nd XPath query return same result items as the first . Instead ,on browser, the scroll work well and return the second train of result items 8MORE THAN 13). Then , does HtmlUnit is not designed for this ? a bug ? or there is another HtmlUnit trick?

I tried also

ScriptResult res =page.getBody().fireEvent("scroll");

..But even this work .

Finally , I thought , if HtmlUnit can't manage Scroll Event
maybe is possible to fire the JS code fired by Scroll Event , in this way I can bypass the scroll event and obtaining his result .

But , does HtmlUnit can make an Ajax request ? How ?

thanks

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions