问题
If I create 2 WebClients in different threads, how do I make them use the same cookies?
回答1:
You can use the below code:
CookieManager cookieManager = new CookieManager();
webClient1.setCookieManager(cookieManager);
webClient2.setCookieManager(cookieManager);
来源:https://stackoverflow.com/questions/3043745/how-to-make-2-htmlunits-webclients-use-same-cookies