2011-11-23 73 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() 
相关问题