如何使jsoup等待完整页面(跳过进度页面)加载? [英] how to make jsoup wait for the complete page(skip a progress page) to load?

查看:2855
本文介绍了如何使jsoup等待完整页面(跳过进度页面)加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试解析网页并使用Jsoup提取数据。但链接是动态的,并在显示详细信息之前抛出等待加载的页面。所以Jsoup似乎处理等待页面而不是详细信息页面。无论如何要等到页面满载?

I am trying to parse a webpage and extract data using Jsoup. But the link is dynamic and throws up a wait-for-loading page before displaying the details. So the Jsoup seems to process the waiting page rather than the details page. is there anyway to make this wait till page is fully loaded?

推荐答案

如果某些内容是在加载页面后动态创建的,那么解析完整内容的最佳机会将是将Selenium与JSoup一起使用:

If some of the content is created dynamically once the page is loaded, then your best chance to parse the full content would be to use Selenium with JSoup:

WebDriver driver = new FirefoxDriver();
driver.get("http://stackoverflow.com/");
Document doc = Jsoup.parse(driver.getPageSource());

这篇关于如何使jsoup等待完整页面(跳过进度页面)加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆