简体   繁体   English

有关Selenium(with Java)和Firefox连接的问题

[英]Facing issue regarding Selenium(with java) and Firefox connectivity

Error: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. 错误:45000毫秒后无法连接到端口7055上的主机127.0.0.1。

Before all scripts were working fine..but now every script has stopped working. 在所有脚本都可以正常工作之前..但是现在每个脚本都停止了工作。 I have updated Selenium version 3.0.1.(updated jar files), updated Firefox version 52.0.2 ...java version 8. 我已经更新了Selenium版本3.0.1。(已更新的jar文件),更新的Firefox版本52.0.2 ... java版本8。

Please suggest what I am missing? 请提出我想念的东西吗?

For Selenium 2.x later versions need to maintain geckodriver for firefox browser and if you find same issue then add binary path to your driver instance and try again. 对于Selenium 2.x以后的版本,需要为firefox浏览器维护geckodriver,如果发现相同的问题,请将二进制路径添加到驱动程序实例,然后重试。

Reference: 参考:

selenium 2.53.0 with firefox 46 Firefox 2.5使用硒2.53.0

with Geckodriver version v0.15 , you have to use selenium 3.3.1 与Geckodriver版本v0.15 ,你必须使用硒3.3.1

You would need to provide firefox binary location. 您将需要提供firefox二进制位置。 One way of doing it is by the below code - 一种方法是通过以下代码-

FirefoxOptions options = new FirefoxOptions();
options.setBinary("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"); //Location where Firefox is installed

DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("moz:firefoxOptions", options);

FirefoxDriver driver = new FirefoxDriver(capabilities);
driver.get("http://www.google.com");

More info here - http://www.automationtestinghub.com/selenium-3-0-launch-firefox-with-geckodriver/ 此处的更多信息-http: //www.automationtestinghub.com/selenium-3-0-launch-firefox-with-geckodriver/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM