2011-11-23 30 views
1

我編寫了打開Goog​​le的selenuim代碼,將一些搜索條件發送到引擎並在結果頁面中單擊特定鏈接。一切都很好,但如果我在大多數情況下將代理設置設置爲firefox,webDriver會非常緩慢地打開谷歌,一切都停在這裏。 WebDriver找不到google的搜索輸入和代碼停止。selenuim在使用代理設置時會停止工作

這裏是設置代理碼設置

  FirefoxProfile profile = new FirefoxProfile(); 
      profile.setPreference("network.proxy.type", 1); 
      profile.setPreference("network.proxy.http","some Proxy"); 
      profile.setPreference("network.proxy.http_port", port); 
      driver = new FirefoxDriver(profile); 

我不明白爲什麼當我使用代理的webdriver無法正常工作。

回答

1

Google切換到https。爲了使其起作用,您需要接受SSL證書。 Java應該類似,但在Python中只需添加:

profile.accept_untrusted_certs = True 
profile.update_preferences() 
相關問題