jeudi 2 février 2017

Not getting all html from website using jsoup

I know that there is a large number of questions of this type but i didn't found an answer...

So the problem is as in Subject. At the beginning webpage requires me to enter a login and password - after log in i'm trying to get whole html but instead of that i have like 10-20% of html and rest of received data is even dont know from where (example below)...

> <script type="text/javascript">
> 
> window.currentUserName="******"; 
> window.currentUserGroups={};
> window.currentUserRoles={};
> 
> window.currentUserGroups['InventoryEditor']=true;
> window.currentUserRoles['InventoryEditor']=true;
> window.currentUserGroups['inventoryScriptBypass']=true;
> window.currentUserRoles['User']=true;
> window.currentUserGroups['rsuser']=true;
> window.currentUserRoles['User']=true;
> 
> 
> window.getCurrentUserName = function() {
>     return window.currentUserName; };
> 
> window.currentUserHasGroup = function(groupName) {
>     return window.currentUserGroups[groupName] ? true : false; };
> 
> window.currentUserHasGroups = function(groupNames) {
>     for (var i = 0; i < groupNames.length; i++) {
>         if (window.currentUserHasGroup(groupNames[i])) {
>             return true;
>         }
>     }
>     return false; };

and many many more...

My source code below:

Connection.Response loginForm = Jsoup.connect("Website before login")
        .method(Connection.Method.GET)
        .execute();

Document document = Jsoup.connect("Website after login")
        //.maxBodySize(0)
        //.timeout(0)
        .data("cookieexists", "false")
        .data("login", "login")
        .data("password", "password")
        .data("submit", "Sign in")
        .cookies(loginForm.cookies())
        .get();

System.out.println(document); }

When i'm trying to get html from website before login it's working well... Thanks for your help !




Aucun commentaire:

Enregistrer un commentaire