0
我的以下Java代碼應該打開一個Firefox窗口並導航到 http://whatismyipaddress.com/ip-lookup
,以便我可以查看我的代理設置是否有效。Java Selenium FirefoxDriver忽略代理設置
final String proxy = "86.100.118.44:80";
Proxy p = new org.openqa.selenium.Proxy();
p.setHttpProxy(proxy)
.setFtpProxy(proxy)
.setSslProxy(proxy);
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(CapabilityType.PROXY, p);
WebDriver browser = new FirefoxDriver(cap);
browser.get("http://whatismyipaddress.com/ip-lookup");
但網站顯示我的原始IP地址,而不是代理人的IP地址。我已經嘗試了來自不同來源的不同代理以及不同的IP查找網站。
這裏是控制檯顯示:
Okt 02, 2016 10:37:57 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFORMATION: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
1475440677875 Marionette INFO Listening on port 59000
1475440678867 Marionette INFO startBrowser 11b45228-3a63-4639-9ba3-777c16a0cab8
Okt 02, 2016 10:37:59 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFORMATION: Detected dialect: W3C
下面是官方文檔:http://docs.seleniumhq.org/docs/04_webdriver_advanced.jsp#firefox