0

Hello i am developing a post tracking application and my main tracking info query is based on parsing the info from html url connection using jsoup however i am facing a small issue. when i establish connection to the url and getting the entire text from the website i get result of "please wait while tracking info is retrieved" it is probably because the connection is immidiate but in my case i need to connect and wait a few seconds until the info is retrieve.so my question is What is the right approach for this? thanks in advance

 public class gettracking extends AsyncTask<Void,Void,Void> {
    String status,TAG="trackingquery";


    @Override
    protected void onPostExecute(Void aVoid) {
        super.onPostExecute(aVoid);
    }

    @Override
    protected Void doInBackground(Void... voids) {

        try {


            Document doc = Jsoup.connect("http://www.israelpost.co.il/itemtrace.nsf/mainsearch?OpenForm&L=HE&itemcode=RR123456789IL").get();


            status =doc.text();
            Log.d(TAG,status);
        }catch (Exception e){
            e.printStackTrace();
        }


        return null;
    }
}

}

MIKE PERETZ
  • 149
  • 2
  • 17
  • 2
    try `Jsoup.connect(url).timeout(10000).get();` – ELITE Jul 16 '17 at 08:29
  • Possible duplicate of [How to pause before parsing in jsoup?](https://stackoverflow.com/questions/42614833/how-to-pause-before-parsing-in-jsoup) – ELITE Jul 16 '17 at 08:32
  • i am still getting the same results not working – MIKE PERETZ Jul 16 '17 at 13:08
  • 1
    You would not get it working..if you see above question, you'll get it why. – ELITE Jul 16 '17 at 14:59
  • i understand. what is the best approach to resolve this? is there any other library or technique to query the website and retrieve traacking results? json maybe? – MIKE PERETZ Jul 16 '17 at 15:05
  • try [Html Cleaner](http://htmlcleaner.sourceforge.net/javause.php) – ELITE Jul 16 '17 at 15:18
  • 1
    You can also use hidden webview in android app and get page contents which are loading after some delay using [how-to-get-html-content-from-a-webview](https://stackoverflow.com/questions/8200945/how-to-get-html-content-from-a-webview) – ELITE Jul 16 '17 at 15:24
  • do you think that a combination of selenium and jsoup could work? – MIKE PERETZ Jul 16 '17 at 15:34

0 Answers0