2012-08-28 44 views
0

使用watir-webdriver進行自動化我無法處理Firefox「不可信連接」。已經試過這個:profile.assume_untrusted_certificate_issuer = false不適用於我

require 'watir-webdriver' 
profile = Selenium::WebDriver::Firefox::Profile.new 
profile.assume_untrusted_certificate_issuer = false 
browser = Watir::Browser.new(:firefox, :profile => profile) 
browser.goto("http://xxx.xxx.xxx.com) 

還是得到了同樣的結果?任何幫助,將不勝感激......

+0

你是什麼意思「無法處理Firefox不可信的連接」?你看到的錯誤或意外行爲是什麼? –

+0

當FF打開並顯示URL「http://__.___.___.com」時,FF打開顯示頁面「此連接不可信」(這是由於網站的SSL證書出現問題)。我想要的只是當我運行我的腳本時,這個頁面不應該顯示,並且URL應該直接打開。 – Mandy

回答

1

這爲我工作:

@profile=Selenium::WebDriver::Firefox::Profile.from_name "default" 
    @profile.assume_untrusted_certificate_issuer=false 
    @profile.secure_ssl = true 
    browser = Watir::Browser.new :firefox, :profile => @profile 
+0

Yoy還可以創建自己的自定義配置文件,接受該網站的所有證書,然後使用上述代碼。 – Mandy

0

能力幫助我:

capabilities = Selenium::WebDriver::Remote::Capabilities.firefox(accept_insecure_certs: true) 
$driver = Selenium::WebDriver.for :firefox, desired_capabilities: capabilities 

geckodriver 0.14.0版本,Mozilla Firefox 52.0,硒的webdriver 3.2.1