HtmlUnit forbid external requests
问题 I use HtmlUnit for automated tests for my site. My site use gmaps api - and it takes a lot of time to send request for external site ( I have few hundreds of tests and few thousands of page loads). I need some way to tell HtmlUnit to load only local pages (stored in IIS express), and forbit loading external resources to make my tests running more quickly. 回答1: You can prevent HTMLUnit from accessing certain URL's using as WebConnectionWrapper : browser.setWebConnection(new