[英]How to scrape Javascript template in Htmlunit?
How to scrape 'handlerbars.js' javascript template in htmlunit 2.21? 如何在HTMLUnit 2.21中抓取'handlerbars.js'JavaScript模板? I try to execute this, but this message shown:
我尝试执行此操作,但显示此消息:
'text/x-javascript-template' is not javascript.
'text / x-javascript-template'不是javascript。
and script does not execute. 并且脚本不执行。 I execute command
page.asXml()
. 我执行命令
page.asXml()
。
Output text is nothing. 输出文本为空。 Do you know dependency for execute javascript template in Htmlunit?
您知道在Htmlunit中执行javascript模板的依赖性吗? Please help.
请帮忙。
This Code 本守则
HtmlUnit Config HtmlUnit配置
webClient = new WebClient(BrowserVersion.CHROME); webClient.getBrowserVersion().setBrowserLanguage("ko-kr"); ConfirmHandler okHandler = new ConfirmHandler() { @Override public boolean handleConfirm(Page page, String message) { logger.info("[Confirm] " + message); return true; } }; AlertHandler alertHandler = new AlertHandler() { @Override public void handleAlert(Page page, String message) { logger.info("[Alert] " + message); } }; webClient.setRefreshHandler(new ImmediateRefreshHandler()); webClient.getOptions().setGeolocationEnabled(true); webClient.getOptions().setRedirectEnabled(true); webClient.getOptions().setUseInsecureSSL(true); webClient.getOptions().setCssEnabled(false); webClient.getOptions().setJavaScriptEnabled(script); webClient.getOptions().setThrowExceptionOnFailingStatusCode(false); webClient.getOptions().setThrowExceptionOnScriptError(false); webClient.getOptions().setTimeout(0); webClient.setAjaxController(new NicelyResynchronizingAjaxController()); webClient.setConfirmHandler(okHandler); webClient.setAlertHandler(alertHandler);
page move code 页面移动代码
page = webClient.getPage("https://promotions.expediapartnercentral.com/promotions/manageroomandrate.html?htid=" + siteIdx); webClient.waitForBackgroundJavaScript(1000);
page.asXml() repsonse is empty(script is not execute) page.asXml()响应为空(脚本未执行)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.