当我运行selenium webdriver代码Firefox webdriver没有通过给定的webaddress启动

时间:2016-01-13 10:27:17

标签: java selenium-webdriver

当我尝试启动Firefox网络驱动程序时,它没有启动它显示firefox默认页面

    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/

4 个答案:

答案 0 :(得分:2)

Firefox是最兼容的selemium浏览器之一,同时也是最不兼容的浏览器之一。

我之所以这样说是因为如果你没有正确版本的selenium库来运行你正在运行的firefox版本,反之亦然,那么它总会失败。

我首先尝试切换到不同版本的Firefox。 Selenium版本2.48.0支持Firefox版本24-41,因此如果您的Firefox版本不适合该范围,则很可能是问题。

答案 1 :(得分: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 :(得分:0)

我遇到了同样的问题。该问题的解决方案是更新selenium版本。当你提到的页面在firefox启动时打开时,请转到选项 - >插件 - >扩展。你将能够在那里看到错误。我得到“Forefox Webdriver无法加载并被禁用”。

这是在Firefox 43上使用selenium 2.44。更新到硒2.51纠正了这个问题。

答案 3 :(得分:0)

试试这个..这将解决问题..

tFileInputJson--> component --> Basic settings--> Mapping

如果你想覆盖firefox的属性,那么, 1.首先找到浏览器属性列表,输入" about:config"在地址网址中 2.use,setPreference方法设置/赋值..