java.net.ConnectException:连接被拒绝:通过GeckoDriver启动Firefox时进行连接 [英] java.net.ConnectException: Connection refused: connect while launching Firefox through GeckoDriver

查看:114
本文介绍了java.net.ConnectException:连接被拒绝:通过GeckoDriver启动Firefox时进行连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载了最新版本的Firefox,即Quantum.对于Selenium,以前不需要为Firefox下载任何可执行文件来打开URL,但是现在它抛出了为GeckoDriver设置属性的错误.

I have downloaded the latest version of Firefox ie Quantum. For Selenium,earlier there was no need of downloading any executable for Firefox to open an URL but now it throws an error of setting property for GeckoDriver.

因此,我下载了最新版本的 geckodriver-v0.20.1-arm7hf.tar.gz ,并将其放在System.setProperty()中,因此引发了连接拒绝错误.

So, I downloaded the latest version of geckodriver-v0.20.1-arm7hf.tar.gz and put that in System.setProperty() so it has thrown an error of connection refusal.

因此,我使用了替代方法在Chrome上打开URL.下载了chromeExecutable,并且能够在没有任何连接拒绝的情况下打开.

So, I used the alternative for opening the URL on Chrome. Downloaded chromeExecutable and was able to open without any connection refusal.

代码段:-

System.setProperty("webdriver.gecko.driver", "C:\\XYZ\\XXXX\\Downloads\\geckodriver-v0.20.1-arm7hf.tar.gz");
    WebDriver driver=new FirefoxDriver();
    driver.get("https://google.com");

控制台错误:

Caused by: java.net.ConnectException: Connection refused: connect

任何人都可以帮助解决Mozilla Firefox上的问题吗?

Can anyone please help to figure out the issue on Mozilla Firefox?

谢谢 Mehak

推荐答案

您的问题中没有很多信息,但我想以下是一个问题:

There aren't a lot of infos in your question, but I guess the following is an issue:

System.setProperty("webdriver.gecko.driver","C:\ XYZ \ XXXX \ Downloads \ geckodriver-v0.20.1-arm7hf.tar.gz");

System.setProperty("webdriver.gecko.driver", "C:\XYZ\XXXX\Downloads\geckodriver-v0.20.1-arm7hf.tar.gz");

似乎您在Windows操作系统下(分析路径),但是您正在设置 geckodriver-v0.20.1-arm7hf.tar.gz .

seems you are under a Windows OS (analyzing the path) but you are setting geckodriver-v0.20.1-arm7hf.tar.gz.

如果您使用的是Windows操作系统,则应该:

If you have a windows os, you should:

  1. 此处下载相关版本(geckodriver-v0.20.1-win64.zip或geckodriver-v0.20.1-win32.zip,取决于您的操作系统)
  2. 解压缩它,并在System.setProperty中设置提取的 geckodriver.exe
  3. 的路径.
  1. Download from here the related version (geckodriver-v0.20.1-win64.zip or geckodriver-v0.20.1-win32.zip, it depends on your OS)
  2. Extract it and set, in the System.setProperty, the path to the extracted geckodriver.exe

类似的东西:

System.setProperty("webdriver.gecko.driver", "C:\ XYZ \ XXXX \ Downloads \ geckodriver.exe");

System.setProperty("webdriver.gecko.driver", "C:\XYZ\XXXX\Downloads\geckodriver.exe");

如果您在另一个操作系统下,则应下载适当的资产并执行基本相同的操作.如果您使用的是linux/mac os,则必须确保提取的geckodriver是可执行的.

If you are under another os, you should download the proper asset and do basically the same thing. If you hava a linux/mac os, you have to be sure that the extracted geckodriver is executable.

这篇关于java.net.ConnectException:连接被拒绝:通过GeckoDriver启动Firefox时进行连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆