Java 启动firefox时,org.openqa.selenium.firefox.NotConnectedException

Java 启动firefox时,org.openqa.selenium.firefox.NotConnectedException,java,selenium,firefox,webdriver,Java,Selenium,Firefox,Webdriver,我在尝试启动Firefox浏览器时收到此错误消息: org.openqa.selenium.firefox.NotConnectedException:无法连接 45000毫秒后,在端口7055上承载127.0.0.1。Firefox控制台输出: s“:[],“hasEmbeddedWebExtension”:false} 我正在使用selenium 3.3.1和firefox 52我会检查你的驱动程序,例如geckodriver与安装的firefox版本兼容 这里有一个类似的问题可能会帮助您:

我在尝试启动
Firefox
浏览器时收到此错误消息:

org.openqa.selenium.firefox.NotConnectedException:无法连接 45000毫秒后,在端口7055上承载127.0.0.1。Firefox控制台输出: s“:[],“hasEmbeddedWebExtension”:false}


我正在使用
selenium 3.3.1
firefox 52

我会检查你的驱动程序,例如geckodriver与安装的firefox版本兼容

这里有一个类似的问题可能会帮助您:

我会检查您的驱动程序,例如geckodriver是否与已安装的Firefox版本兼容

这里有一个类似的问题可能会帮助您:

尝试放置Gecko驱动程序的路径
System.setProperty(“webdriver.gecko.driver”和“”)

尝试放置gecko驱动程序的路径
System.setProperty(“webdriver.gecko.driver”和“”)

您需要在Firefox中使用GeckoDriver。旧版本的Selenium 2.x不需要此功能,但Selenium 3.x需要此功能

您需要根据您的FF浏览器是32位还是64位下载GeckoDriver。您还需要提供GeckoDriver和FirefoxBirnary路径。可以用于启动浏览器的示例代码-

System.setProperty("webdriver.gecko.driver","D:\\Firefox\\geckodriver.exe");

FirefoxOptions options = new FirefoxOptions();
options.setBinary("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"); //This is the location where you have installed Firefox on your machine

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

您可以查看此链接了解更多信息-

您需要使用GeckoDriver for Firefox。旧版本的Selenium 2.x不需要此链接,但Selenium 3.x需要此链接

您需要根据您的FF浏览器是32位还是64位下载GeckoDriver。您还需要提供GeckoDriver和FirefoxBirnary路径。可以用于启动浏览器的示例代码-

System.setProperty("webdriver.gecko.driver","D:\\Firefox\\geckodriver.exe");

FirefoxOptions options = new FirefoxOptions();
options.setBinary("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"); //This is the location where you have installed Firefox on your machine

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

您可以查看此链接了解更多信息-

显示您的浏览器配置代码显示您的浏览器配置代码我需要使用GeckoDriver吗?您需要使用驱动程序将selenium连接到浏览器,在Firefox中,这是一个名为GeckoDriver的驱动程序,您可以获得它。请确保在使用gecko驱动程序时也使用selenium 3.3.1。我正在使用gecko Versionn-v0.15在45000毫秒后无法连接到端口7055上的主机127.0.0.1。Firefox控制台输出:65个加载项。xpi调试在启动时调用引导方法aushelper@mozilla.org版本2.0System.setProperty(“webdriver.gecko.driver”,“C:\\gecko\\geckodriver.exe”);webdriver driver=new FirefoxDriver();driver.get(“);System.out.println(“成功打开网站”);睡眠(5);driver.quit();我需要使用GeckoDriver吗?您需要使用一个驱动程序将selenium连接到浏览器,在Firefoxs中,这是一个名为GeckoDriver的驱动程序,您可以获得它。请确保在使用gecko驱动程序时也使用selenium 3.3.1。我使用的gecko版本-v0.15在45000毫秒后无法连接到端口7055上的主机127.0.0.1。Firefox控制台输出:65个加载项。xpi调试在启动时调用引导方法aushelper@mozilla.org版本2.0System.setProperty(“webdriver.gecko.driver”,“C:\\gecko\\geckodriver.exe”); WebDriver=newfirefoxdriver();driver.get(“);System.out.println(“成功打开网站”);Thread.sleep(5);driver.quit();谢谢@Anish Pillai。我试着按照步骤设置gecko,但不幸的是,现在仍然面临这个问题。org.openqa.selenium.firefox.NotConnectedException:45000毫秒后无法连接到端口7055上的主机127.0.0.1。firefox控制台输出:webNavigation“,”webRequest“]}以及firefox浏览器启动时,有两个选项卡打开,在第二个选项卡上我可以看到“Skype”网站启动。谢谢@Anish Pillai。我试着按照这些步骤设置gecko,但不幸的是,现在仍然面临这个问题。org.openqa.selenium.firefox.NotConnectedException:45000毫秒后无法连接到端口7055上的主机127.0.0.1。firefox控制台输出:webNavigation“,”webRequest“]}}并且当firefox浏览器启动时,有两个选项卡打开,在第二个选项卡上我可以看到“Skype”网站启动。我使用的是selenium版本3.3.1System.setProperty(“webdriver.gecko.driver,“C:\\gecko\\geckodriver.exe)webdriver driver=newfirefoxdriver();仍然没有ConnectedException我正在使用selenium版本3.3.1System.setProperty(“webdriver.gecko.driver”,“C:\\gecko\\geckodriver.exe”)webdriver=new FirefoxDriver();仍然没有ConnectedException