Is it possible to use HTTPS proxy in HTMLunit?

心不动则不痛 提交于 2019-12-05 10:16:56

You should not be putting http:// or https:// behind the ip address of the proxy server.

If your http proxy server supports https then htmlunit would automatically use it. Here is an example of how to use proxy with htmlunit

For HTTP proxy

                ProxyConfig pc = new ProxyConfig();
                pc.setSocksProxy(false); //Set to false if it is a http server
                pc.setProxyHost("192.168.1.200"); //your proxy IP
                pc.setProxyPort(proxyPort);
                webClient.getOptions().setProxyConfig(pc);

and of course if you are using socks proxy than set the setSocksProxy to true.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!