我使用JSoup库我没有从安全URL获取完整的html内容(https://) 因为URL将动态获取内容。有没有办法获得安全URL的确切HTML内容(https://)。
答案 0 :(得分:0)
为了解析完整的内容,您可以使用Selenium和Jsoup。
WebDriver driver = new ChromeDriver();
driver.get("https://google.com/");
Document doc = Jsoup.parse(driver.getPageSource());
或者您也可以等待加载特定内容。如下所示:
public void waitForLoad(WebDriver driver) {
ExpectedCondition<Boolean> pageLoadCondition = new
ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver driver) {
return ((JavascriptExecutor)driver).executeScript("return document.readyState").equals("complete");
}
};
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(pageLoadCondition);
}