Tag: htmlunit

如何将HtmlUnit包含在Kotlin项目中

我正在尝试在Kotlin项目中使用HtmlUnit ,但编译时出现以下错误: Error:Kotlin: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath: class com.gargoylesoftware.htmlunit.html.DomElement, unresolved supertypes: ElementTraversal 这是因为ElementTraversal是一个Java 7function。 我该如何解决这个问题?

什么阻止HtmlUnit加载PSN商店页面?

我试图用HtmlUnit加载Playstation商店页面,但看起来像加载的所有内容是“加载…”文本(和一点点的JavaScript)的空白页面。 我使用下面的配置使HtmlUnit工作,但绝望(它的kotlin): @Test @Throws(Exception::class) fun homePage() { val webClient = WebClient(BrowserVersion.INTERNET_EXPLORER).apply { ajaxController = NicelyResynchronizingAjaxController() options.isUseInsecureSSL = true options.isThrowExceptionOnScriptError = false options.isJavaScriptEnabled = true options.isCssEnabled = true options.isRedirectEnabled = true options.isThrowExceptionOnFailingStatusCode = false options.isUseInsecureSSL = true options.isDownloadImages = true cookieManager.isCookiesEnabled = true waitForBackgroundJavaScript(10000) waitForBackgroundJavaScriptStartingBefore(10000) } val page = webClient.getPage<HtmlPage>("https://store.playstation.com/") Thread.sleep(10000) assertFalse(page.asXml().contains("Loading")) } 我在加载页面时看不到任何特定的错误: мая 09, […]

Kotlin + Intelij + HtmlUnit:使用提供的参数不能调用下列函数

我为我的项目使用HtmlUnit,当我尝试下面的代码: webClient.webConnection = FalsifyingWebConnection(webClient) { fun getResponse(request: WebRequest): WebResponse { if(request.getUrl().getPath().toLowerCase().equals("some url i don't need ")) { return createWebResponse(request, "", "application/javascript"); } return super.getResponse(request); } } FalsifyingWebConnection(webClient)发生错误,它说: