org.openqa.selenium.firefox.NotConnectedException:使用GeckoDriver和Firefox执行代码时无法连接到主机127.0.0.1 [英] org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 while executing code using GeckoDriver and Firefox

查看:111
本文介绍了org.openqa.selenium.firefox.NotConnectedException:使用GeckoDriver和Firefox执行代码时无法连接到主机127.0.0.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

代码试用:

public class loginmethod { 

    @Test 
    public void login() throws InterruptedException { 
        System.setProperty("webdriver.gecko.driver", "D:\\Tools\\geckodriver"); 
        WebDriver driver = new FirefoxDriver(); 
        driver.manage().window().maximize(); 
        driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
    }
}

二进制版本详细信息:

  • FireFox:60.0
  • 硒罐:2.45
  • GeckoDriver:20.1

当我使用Firefox驱动程序运行代码时,出现以下错误:

When I run code using Firefox driver following error is given:

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
 Potential driver version mismatch ignored due to missing DLLs igd10umd64 v= and igd10iumd64 v=
*** Blocklist::_preloadBlocklistFile: blocklist is disabled
1526302485156   addons.xpi-utils    DEBUG   Starting async load of XPI database 
1526302485236   addons.xpi  DEBUG   Ignoring file entry whose name is not a valid add-on QA\AppData\Local\Temp\anonymous5274473150250365422webdriver-profile\extensions\webdriver-staging
1526302485236   addons.xpi  DEBUG   Existing add-on fxdriver@googlecode.com in app-profile
1526302485236   addons.xpi  INFO    Mapping activity-stream@mozilla.org to C:\Program Files\Mozilla Firefox\browser\features\activity-stream@mozilla.org.xpi
1526302485236   addons.xpi  INFO    Mapping aushelper@mozilla.org to C:\Program Files\Mozilla Firefox\browser\features\aushelper@mozilla.org.xpi
1526302485236   addons.xpi  INFO    Mapping firefox@getpocket.com to C:\Program Files\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1526302485236   addons.xpi  INFO    Mapping followonsearch@mozilla.com to C:\Program Files\Mozilla Firefox\browser\features\followonsearch@mozilla.com.xpi
1526302485236   addons.xpi  INFO    Mapping formautofill@mozilla.org to C:\Program Files\Mozilla Firefox\browser\features\formautofill@mozilla.org.xpi
1526302485236   addons.xpi  INFO    Mapping onboarding@mozilla.org to C:\Program Files\Mozilla Firefox\browser\features\onboarding@mozilla.org.xpi
1526302485236   addons.xpi  INFO    Mapping screenshots@mozilla.org to C:\Program Files\Mozilla Firefox\browser\features\screenshots@mozilla.org.xpi
1526302485236   addons.xpi  INFO    Mapping shield-recipe-client@mozilla.org to C:\Program Files\Mozilla Firefox\browser\features\shield-recipe-client@mozilla.org.xpi
1526302485236   addons.xpi  INFO    Mapping webcompat@mozilla.org to C:\Program Files\Mozilla Firefox\browser\features\webcompat@mozilla.org.xpi
1526302485236   addons.xpi  DEBUG   Existing add-on activity-stream@mozilla.org in app-system-defaults
1526302485236   addons.xpi  DEBUG   Existing add-on aushelper@mozilla.org in app-system-defaults
1526302485236   addons.xpi  DEBUG   Existing add-on firefox@getpocket.com in app-system-defaults
1526302485236   addons.xpi  DEBUG   Existing add-on followonsearch@mozilla.com in app-system-defaults
1526302485236   addons.xpi  DEBUG   Existing add-on formautofill@mozilla.org in app-system-defaults
1526302485238   addons.xpi  DEBUG   Existing add-on onboarding@mozilla.org in app-system-defaults
1526302485238   addons.xpi  DEBUG   Existing add-on screenshots@mozilla.org in app-system-defaults
1526302485238   addons.xpi  DEBUG   Existing add-on shield-recipe-client@mozilla.org in app-system-defaults
1526302485238   addons.xpi  DEBUG   Existing add-on webcompat@mozilla.org in app-system-defaults
1526302485238   addons.xpi  INFO    Mapping {972ce4c6-7e08-4474-a285-3208198ce6fd} to C:\Program Files\Mozilla Firefox\browser\extensions\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi
1526302485238   addons.xpi  DEBUG   Existing add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} in app-global
1526302485238   addons.xpi  DEBUG   getInstallState changed: false, state: {}
1526302485332   addons.xpi-utils    DEBUG   Async JSON file read took 0 MS
1526302485332   addons.xpi-utils    DEBUG   Finished async read of XPI database, parsing...
1526302485336   addons.xpi-utils    DEBUG   Successfully read XPI database
Crash Annotation GraphicsCriticalError: |[C0][GFX1]: Potential driver version mismatch ignored due to missing DLLs igd10umd64 v= and igd10iumd64 v= (t=6.22361) [GFX1]: Potential driver version mismatch ignored due to missing DLLs igd10umd64 v= and igd10iumd64 v=
Crash Annotation GraphicsCriticalError: |[C0][GFX1]: Potential driver version mismatch ignored due to missing DLLs igd10umd64 v= and igd10iumd64 v= (t=2.67818) [GFX1]: Potential driver version mismatch ignored due to missing DLLs igd10umd64 v= and igd10iumd64 v=

推荐答案

此错误消息...

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
 Potential driver version mismatch ignored due to missing DLLs igd10umd64 v= and igd10iumd64 v=
*** Blocklist::_preloadBlocklistFile: blocklist is disabled

...表示GeckoDriver无法成功启动/产生新的Web客户端会话/实例.

...implies that the GeckoDriver was unable to initiate/spawn a new Web Client session/instance successfully.

您的主要问题是所使用的二进制文件之间的版本兼容性:

Your main issue is the version compatibility between the binaries you are using as follows :

  • 您的 Selenium Client 版本是 2.45 ,这几乎是 2.5年.
  • 您的 GeckoDriver 版本是 v20.1 .
  • 0.19.0(2017-09-16)的发行说明明确提到以下内容:
  • Your Selenium Client version is 2.45 which is almost 2.5 years older.
  • Your GeckoDriver version is v20.1.
  • Release Notes of 0.19.0 (2017-09-16) clearly mentions the following :

请注意,对于geckodriver 0.19.0,建议使用以下版本:

Note that with geckodriver 0.19.0 the following versions are recommended:

  • Firefox 55.0(及更高版本)
  • 硒3.5(及更高版本)
  • Firefox 55.0 (and greater)
  • Selenium 3.5 (and greater)

  • 0.16.0(2017-04-21)的发行说明明确提到以下内容:
    • Release Notes of 0.16.0 (2017-04-21) clearly mentions the following :
    • 请注意,geckodriver v0.16.0仅与 Selenium 3.4 及更高版本兼容.

      • 您的 Firefox 版本是 v60.0 .
        • Your Firefox version is v60.0.
        • 因此 Selenium Client v2.45 GeckoDriver v20.1 Firefox v60.0 之间显然不匹配.

          So there is a clear mismatch between Selenium Client v2.45, GeckoDriver v20.1 and Firefox v60.0.

          • JDK 升级到最新级别 JDK 8u162 .
          • 升级到当前级别> 版本3.11.0 > .
          • GeckoDriver 升级到 GeckoDriver v0.20.1 级.
          • GeckoDriver位于指定位置.
          • GeckoDriver对非root用户具有可执行权限.
          • Firefox 版本升级到 Firefox v60.0 级别.
          • 通过 IDE
          • 清理您的项目工作区重建您的项目,并且仅具有必需的依赖项.
          • 使用 CCleaner 工具清除之前和之后的所有操作系统杂项在您执行 Test Suite 之后.
          • 如果您的基本 Web客户端版本太旧,请通过来卸载. Revo Uninstaller 并安装最新版本的 Web客户端 GA和发行版.
          • 进行系统重启.
          • 以非root用户身份执行Test.
          • 始终在tearDown(){}方法中调用driver.quit()以关闭&优雅地销毁 WebDriver Web Client 实例.
          • Upgrade JDK to recent levels JDK 8u162.
          • Upgrade Selenium to current levels Version 3.11.0.
          • Upgrade GeckoDriver to GeckoDriver v0.20.1 level.
          • GeckoDriver is present in the specified location.
          • GeckoDriver is having executable permission for non-root users.
          • Upgrade Firefox version to Firefox v60.0 levels.
          • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
          • Use CCleaner tool to wipe off all the OS chores before and after the execution of your Test Suite.
          • If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
          • Take a System Reboot.
          • Execute your Test as a non-root user.
          • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

          这篇关于org.openqa.selenium.firefox.NotConnectedException:使用GeckoDriver和Firefox执行代码时无法连接到主机127.0.0.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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