简体   繁体   English

HTMLUnit仅执行一个功能

[英]HTMLUnit Execute only one Function

I am using HTMLUnit to crawl webpages. 我正在使用HTMLUnit爬行网页。 The problem is that setting Javascript on really slow down the process, i need to execute only one function, is it possible to skip all JS except the one function i set in the executeJavaScript()? 问题在于,将Javascript设置为真的会减慢该过程,我只需要执行一个函数,是否有可能跳过除我在executeJavaScript()中设置的一个函数之外的所有JS?

maybe 也许

             webClient.getOptions().setJavaScriptEnabled(false);

at start and once you are at the point you want to use it again 在开始时,一旦您要重新使用它

             webClient.getOptions().setJavaScriptEnabled(true);

I didn't test it though! 我没有测试!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM