问题
I need to pause my script before parsing (i want to wait for some information), but how can i do this in Jsoup?
I tried this:
link = Jsoup.connect("link").wait(100).get();
But this doesn't work for me.
回答1:
Usually the need for waiting arises when content is loaded via AJAX. Jsoup can't deal with such stuff, because it is not a browser. Jsoup simply interprets HTML. The connection stuff is more or less only a wrapper around Java connections.
I guess you need to either identify the AJAX calls directly and get the contents of the AJAX calls, or you can use a real browser, i.e. selenium with phantomjs or similar.
来源:https://stackoverflow.com/questions/42614833/how-to-pause-before-parsing-in-jsoup