[英]How to make sure that my application is using Proxy server and not my IP address in selenium?
I am using Selenium with PhantomJS browser. 我在PhantomJS浏览器中使用Selenium。 I have set up proxy as below:
我已经设置代理如下:
DesiredCapabilities capabilities = DesiredCapabilities.phantomjs();
capabilities.setJavascriptEnabled(true);
System.setProperty("phantomjs.binary.path", "../Drivers/phantomjs.exe");
ArrayList<String> cliArgsCap = new ArrayList<String>();
cliArgsCap.add("--proxy=hostname:port");
cliArgsCap.add("--proxy-auth=username:password");
cliArgsCap.add("--proxy-type=http");
capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, cliArgsCap);
driver = new PhantomJSDriver(capabilities);
My application is running fine. 我的应用程序运行良好。 But how to validate if my application is using the proxy that I have set up?
但是,如何验证我的应用程序是否正在使用已设置的代理?
You can using fiddler to setup a proxy server on your local, after that, change your selenium proxy configuration to proxy you have setup. 您可以使用fiddler在本地上设置代理服务器 ,然后,将硒代理配置更改为已设置的代理。 Let's run your app, if your app going throw proxy then fiddler will catch it.
让我们运行您的应用程序,如果您的应用程序将抛出代理,则提琴手会抓住它。
在运行主脚本之前,向显示客户端当前IP的http://api.ipify.org/发出请求,并检查代码是您的IP还是代理IP。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.