@Test
fun testGetVideoHotRank() {
val webClient = WebClient(BrowserVersion.CHROME)
webClient.options.isThrowExceptionOnScriptError = false
webClient.options.isThrowExceptionOnFailingStatusCode = false
webClient.options.isCssEnabled = true
webClient.options.isJavaScriptEnabled = true
webClient.ajaxController = NicelyResynchronizingAjaxController()
var page: HtmlPage? = null
try {
page = webClient.getPage("https://t.youku.com/yep/page/s/hot_search_rank")
} catch (e: Exception) {
e.printStackTrace()
} finally {
webClient.close()
}
webClient.waitForBackgroundJavaScript(30000)
val pageXml = page?.asXml()
println(pageXml.toString())
}
When visiting this site, it seems that the content is not displaying because the js is not loading.