Javasctipt is not java. you can get the document height using javaobject
B4X:
Private Sub getWebDocHeight() as int
Dim j as JavaObject = WebView1
return j.RunMethodJO("getEngine", Null).RunMethod("executeSctipt", Array("doucment.body.scrollHeight"))
End Sub