2016-01-13 27 views
1

開始時,我試圖開始Firefox網絡驅動它不是開始它顯示Firefox的默認頁當我運行硒的webdriver代碼的Firefox的webdriver無法通過給定的webaddress

WebDriver dr = new FirefoxDriver(); 
    dr.get("https://www.google.co.in/"); 
    dr.manage().window().maximize(); 

它不是開始它顯示Firefox的默認頁 下面我附上輸出圖像的截圖

https://www.mozilla.org/en-US/firefox/43.0.4/firstrun/learnmore/

+0

您正在使用哪個webdriver版本? 2.48.2? – parishodak

+0

是的,我使用2.48.2 –

+1

嘗試與較低的Firefox版本 – Paras

回答

0

我面臨同樣的問題。解決這個問題的方法是更新硒版本。當您提到的頁面即https://www.mozilla.org/en-US/firefox/43.0.4/firstrun/learnmore/在Firefox啓動時打開,請轉到選項 - >擴展 - >擴展。您將能夠在那裏看到錯誤。我得到了「Forefox Webdriver無法加載並且被禁用」。

這是在Firefox 43上,硒2.44。更新到硒2.51糾正了這個問題。

0

對不起,我不能評論,但是我想幫助。當我使用集成在我的python腳本中的selenium webdriver時,我遇到了類似的問題。問題出在憑證上(特別是在聲明新的webdriver對象時使用SSL協議)。我使用的代碼看起來如下:

driver = webdriver.PhantomJS(executable_path = "/opt/local/bin/phantomjs", service_args=['--ignore-ssl-errors=true']) 

正如你可以看到我使用一個密鑰忽略SSL錯誤。這解決了我的問題,所以我不確定你用什麼平臺編寫代碼,但希望你能找到類似的對象調用。

我發現人們如何處理不受信任的證書here。特別是對於FireFox:

//It creates firefox profile 
FirefoxProfile profile=new FirefoxProfile(); 

// This will set the true value 
profile.setAcceptUntrustedCertificates(true); 

// This will open firefox browser using above created profile 
WebDriver driver=new FirefoxDriver(); 

driver.get("pass the url as per your requirement"); 

希望它可以幫助你!

最好。 -Petr。

2

Firefox是selemium最兼容的瀏覽器之一,同時也是兼容性最差的瀏覽器之一。

我這樣說是因爲如果你沒有正確版本的硒庫去使用你正在運行的firefox版本,反之亦然,它總是會失敗。

我會從嘗試切換到不同版本的Firefox開始。 Selenium版本2.48.0支持Firefox版本24-41,所以如果你的Firefox版本不適合這個範圍,那很可能是這個問題。

0

試試這個。這將解決這個問題..

FirefoxProfile fpi = new FirefoxProfile(); 
    fpi.setPreference("browser.startup.homepage_override.mstone", "ignore"); 
    fpi.setPreference("startup.homepage_welcome_url.additional", "about:blank"); 
    wd = new FirefoxDriver(fpi); 
    wd.get("http://www.google.com"); 
如果你想爲忽略的Firefox的性能

,然後, 1.首先找到瀏覽器屬性的列表,請鍵入「 about:config「中的地址url 2.use,setPreference方法設置/賦值..