使用硒代理
在过去的两天我一直在试图使用代理与硒,那不是的究竟的,虽然这个问题。问题是,代理为私人这意味着它需要认证使用它(用户名和密码),但我无法弄清楚如何做到这一点。
for the past two days I've been trying to use a proxy with Selenium, that's not exactly the issue though. The issue is that the proxy is private meaning it needs authentication to use it (Username and Password) but I can't figure out how to do it.
我使用的是Firefox的驱动力,像这样的配置文件:
I'm using a Firefox driver, with a profile like so:
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.SetPreference("network.proxy.type", 1);
firefoxProfile.SetPreference("network.proxy.http", "23.95.115.87");
firefoxProfile.SetPreference("network.proxy.http_port", 80);
var driver = new FirefoxDriver(firefoxProfile);
driver.Navigate().GoToUrl("http://ipchicken.com");
我想它会问我的用户名和密码(在对话框中),但没有任何反应,它只是导航到该网页,并显示我自己的IP。我无法在此找到什么真正的,任何帮助球员?谢谢你这么多。
I figured that it would ask me for the username and password (in a dialog box) yet nothing happens, it just navigates to the webpage, and displays my own IP. I can't find anything really on this, any help guys? Thank you so much.
我不是在硒的专家,但我可以帮助你使你的代理认证免费。
I am not an expert in Selenium but I can help you in making your proxy authentication free.
如果您使用的是Windows,下载的东西像CC-代理(其免费为单个用户),并添加代理服务器作为级联代理。这将在计算机上创建一个本地代理服务器,这将不要求用户名/密码。然后你就可以在硒使用本地代理服务器。
If you are on Windows, download something like CC-Proxy ( Its free for a single user) and add your proxy as a cascading proxy. This will create a local proxy server on your computer which won't require username/password. Then you can use the local proxy server in selenium.
如果你是在Linux上,你可以用酒来运行CC-代理,也可以使用tinyproxy或鱿鱼(它是一个矫枉过正)。
If you are on Linux, you can use wine to run CC-Proxy or you can use tinyproxy or squid ( it is an overkill).
注释,如果你面对在建立CC-代理或tinyproxy问题。
Comment if you face problem in setting up CC-Proxy or tinyproxy.