-
-
Notifications
You must be signed in to change notification settings - Fork 184
Description
I want to use the Java HtmlUnit library to generate a BIRT report in HTML. However, BIRT shows a process bar while the data is loaded from the database and assembled on the page. When I am opening the BIRT report with HtmlUnit, only the page with the process bar is returned but the report content information remains empty.
The returned HTML page contains a div <DIV ID="Document" CLASS="birtviewer_document_fragment"></DIV> which is empty but should be getting filled by the report generator. However, whatever I do, I don't get this "Document" Div filled with data.
I am using the following code:
WebClient webClient = new WebClient(BrowserVersion.CHROME);
HtmlPage page=null;
try {
page = webClient.getPage("https://....");
webClient.waitForBackgroundJavaScript(60000);
System.out.println("Waiting 5 secs.....");
synchronized (page) {
page.wait(5000);
}
} catch (FailingHttpStatusCodeException | IOException | InterruptedException e) {
e.printStackTrace();
}
DomElement oe = page.getElementById("Document");
System.out.println(oe.getChildElementCount());
webClient.close();
As output I am always getting 0 for the number of children of the Document div. When I print the HTML source code of the page, I always get the empty Document div.
I tried using window.animateAnimationsFrames() after webClient.waitForBackgroundJavaScript(60000) but the pending frames are 0 and the final result is the same as before.
What am I doing wrong? Could someone please put me in the right direction. Thank you.