How to make 2 HtmlUnit's WebClients use same cookies?

前端 未结 1 821
心在旅途
心在旅途 2020-12-21 15:30

If I create 2 WebClients in different threads, how do I make them use the same cookies?

1条回答
  •  鱼传尺愫
    2020-12-21 16:10

    You can use the below code:

    CookieManager cookieManager = new CookieManager();
    webClient1.setCookieManager(cookieManager);
    webClient2.setCookieManager(cookieManager);
    

    0 讨论(0)
提交回复
热议问题