2016-01-13 50 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方法设置/赋值..