使用firefox配置文件启动firefox时引发NotConnectedException

使用firefox配置文件启动firefox时引发NotConnectedException,firefox,webdriver,Firefox,Webdriver,Selenium jars:2.34,Firefox版本:22.0 请查找以下代码: FirefoxProfile firefoxProfile = new FirefoxProfile(new File("C:\\Users\\admin\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\dww46q4q.default")); WebDriver driver = new FirefoxDriver(firefoxProfile); driver.

Selenium jars:2.34,Firefox版本:22.0

请查找以下代码:

FirefoxProfile firefoxProfile = new FirefoxProfile(new File("C:\\Users\\admin\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\dww46q4q.default"));
WebDriver driver = new FirefoxDriver(firefoxProfile);
driver.get("https://www.google.com");
Firefox浏览器启动,但它没有导航到google.com,过了一段时间后,我遇到了以下异常:org.openqa.selenium.Firefox.NotConnectedException:45000毫秒后无法连接到端口7055上的主机127.0.0.1。Firefox控制台输出:

当我在不使用firefox配置文件的情况下启动firefox浏览器时,它工作正常,即firefox浏览器启动,导航到google.com,没有异常发生

控制台输出

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1      on port 7055 after 45000 ms. Firefox console output:
*** LOG addons.xpi: startup
*** LOG addons.xpi: Skipping unavailable install location app-system-local
*** LOG addons.xpi: Skipping unavailable install location app-system-share
*** LOG addons.xpi: Ignoring file entry whose name is not a valid add-on ID:  
C:\Windows\TEMP\anonymous3048824074469384020webdriver-profile\extensions\webdriver-staging
*** LOG addons.xpi: checkForChanges
*** LOG addons.xpi-utils: Opening database
*** LOG addons.xpi: Add-on FireXPath@pierre.tholence.com modified in app-profile
*** Blocklist::_loadBlocklistFromFile: blocklist is disabled
*** LOG addons.xpi: Add-on firebug@software.joehewitt.com modified in app-profile
*** LOG addons.xpi: Loading bootstrap scope from   
C:\Windows\TEMP\anonymous3048824074469384020webdriver- profile\extensions\firebug@software.joehewitt.com.xpi
*** LOG addons.xpi: Calling bootstrap method install on firebug@software.joehewitt.com  version 1.11.4
*** LOG addons.xpi: Add-on seleniumbuilder@saucelabs.com modified in app-profile
*** LOG addons.xpi: Add-on {5384767E-00D9-40E9-B72F-9CC39D655D6F} modified in app-profile
*** LOG addons.xpi: Add-on csharpformatters@seleniumhq.org modified in app-profile
*** LOG addons.xpi: Add-on javaformatters@seleniumhq.org modified in app-profile
*** LOG addons.xpi: Add-on rubyformatters@seleniumhq.org modified in app-profile
*** LOG addons.xpi: Add-on {a6fd85ed-e919-4a43-a5af-8da18bda539f} modified in app-profile
*** LOG addons.xpi: Add-on pythonformatters@seleniumhq.org modified in app-profile
*** LOG addons.xpi: New add-on fxdriver@googlecode.com installed in app-profile
*** LOG addons.xpi: Add-on {22181a4d-af90-4ca3-a569-faed9118d6bc} modified in winreg-app-global
*** LOG addons.xpi: Updating database with changes to installed add-ons
*** LOG addons.xpi-utils: Updating add-on states
*** LOG addons.xpi-utils: Writing add-ons list
*** LOG addons.xpi: Calling bootstrap method startup on firebug@software.joehewitt.com version 1.11.4
*** LOG addons.manager: shutdown
*** LOG addons.xpi: shutdown
*** LOG addons.xpi-utils: shutdown
*** LOG addons.xpi-utils: Database closed
*** LOG addons.xpi: startup
*** LOG addons.xpi: Skipping unavailable install location app-system-local
*** LOG addons.xpi: Skipping unavailable install location app-system-share
*** LOG addons.xpi: Ignoring file entry whose name is not a valid add-on ID: 
C:\Windows\TEMP\anonymous3048824074469384020webdriver-profile\extensions\webdriver-staging
*** LOG addons.xpi: checkForChanges
*** LOG addons.xpi: No changes found
*** LOG addons.xpi: Loading bootstrap scope from 
C:\Windows\TEMP\anonymous3048824074469384020webdriver-profile\extensions\firebug@software.joehewitt.com.xpi
*** LOG addons.xpi: Calling bootstrap method startup on firebug@software.joehewitt.com version 1.11.4
*** LOG addons.xpi-utils: Opening database

at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:106)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:251)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:197)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:190)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:103)
at pack1.downloadfile.test1(downloadfile.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:335)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:330)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
FAILED: test1
org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 7055; process output follows: 
*** LOG addons.xpi: startup
*** LOG addons.xpi: Skipping unavailable install location app-system-local
*** LOG addons.xpi: Skipping unavailable install location app-system-share
*** LOG addons.xpi: Ignoring file entry whose name is not a valid add-on ID: 
C:\Windows\TEMP\anonymous3048824074469384020webdriver-profile\extensions\webdriver-staging
*** LOG addons.xpi: checkForChanges
*** LOG addons.xpi-utils: Opening database
*** LOG addons.xpi: Add-on FireXPath@pierre.tholence.com modified in app-profile
*** Blocklist::_loadBlocklistFromFile: blocklist is disabled
*** LOG addons.xpi: Add-on firebug@software.joehewitt.com modified in app-profile
*** LOG addons.xpi: Loading bootstrap scope from  
C:\Windows\TEMP\anonymous3048824074469384020webdriver-profile\extensions\firebug@software.joehewitt.com.xpi
*** LOG addons.xpi: Calling bootstrap method install on firebug@software.joehewitt.com version 1.11.4
*** LOG addons.xpi: Add-on seleniumbuilder@saucelabs.com modified in app-profile
*** LOG addons.xpi: Add-on {5384767E-00D9-40E9-B72F-9CC39D655D6F} modified in app-profile
*** LOG addons.xpi: Add-on csharpformatters@seleniumhq.org modified in app-profile
*** LOG addons.xpi: Add-on javaformatters@seleniumhq.org modified in app-profile
*** LOG addons.xpi: Add-on rubyformatters@seleniumhq.org modified in app-profile
*** LOG addons.xpi: Add-on {a6fd85ed-e919-4a43-a5af-8da18bda539f} modified in app-profile
*** LOG addons.xpi: Add-on pythonformatters@seleniumhq.org modified in app-profile
*** LOG addons.xpi: New add-on fxdriver@googlecode.com installed in app-profile
*** LOG addons.xpi: Add-on {22181a4d-af90-4ca3-a569-faed9118d6bc} modified in winreg-app-global
*** LOG addons.xpi: Updating database with changes to installed add-ons
*** LOG addons.xpi-utils: Updating add-on states
*** LOG addons.xpi-utils: Writing add-ons list
*** LOG addons.xpi: Calling bootstrap method startup on firebug@software.joehewitt.com  version 1.11.4
*** LOG addons.manager: shutdown
*** LOG addons.xpi: shutdown
*** LOG addons.xpi-utils: shutdown
*** LOG addons.xpi-utils: Database closed
*** LOG addons.xpi: startup
*** LOG addons.xpi: Skipping unavailable install location app-system-local
*** LOG addons.xpi: Skipping unavailable install location app-system-share
*** LOG addons.xpi: Ignoring file entry whose name is not a valid add-on ID: 
org.openqa.selenium.firefox.NotConnectedException:45000毫秒后无法连接到端口7055上的主机127.0.0.1。firefox控制台输出:
***LOG addons.xpi:启动
***LOG addons.xpi:跳过不可用的安装位置app system local
***LOG addons.xpi:跳过不可用的安装位置应用程序系统共享
***LOG addons.xpi:忽略名称不是有效加载项ID的文件条目:
C:\Windows\TEMP\anonymous3048824074469384020webdriver配置文件\extensions\webdriver暂存
***LOG addons.xpi:检查更改
***LOG addons.xpi-utils:打开数据库
***LOG addons.xpi:加载项FireXPath@pierre.tholence.com修改应用程序内配置文件
***块列表::\u loadBlocklistFromFile:块列表已禁用
***LOG addons.xpi:加载项firebug@software.joehewitt.com修改应用程序内配置文件
***LOG addons.xpi:从加载引导作用域
C:\Windows\TEMP\anonymous3048824074469384020webdriver-profile\extensions\firebug@software.joehewitt.com.xpi
***LOG addons.xpi:在上调用引导方法安装firebug@software.joehewitt.com版本1.11.4
***LOG addons.xpi:加载项seleniumbuilder@saucelabs.com修改应用程序内配置文件
***LOG addons.xpi:在应用程序配置文件中修改的加载项{5384767E-00D9-40E9-B72F-9CC39D65D6F}
***LOG addons.xpi:加载项csharpformatters@seleniumhq.org修改应用程序内配置文件
***LOG addons.xpi:加载项javaformatters@seleniumhq.org修改应用程序内配置文件
***LOG addons.xpi:加载项rubyformatters@seleniumhq.org修改应用程序内配置文件
***LOG addons.xpi:在应用程序配置文件中修改的加载项{a6fd85ed-e919-4a43-a5af-8da18bda539f}
***LOG addons.xpi:加载项pythonformatters@seleniumhq.org修改应用程序内配置文件
***LOG addons.xpi:新的加载项fxdriver@googlecode.com安装在应用程序配置文件中
***LOG addons.xpi:在winreg应用程序全局中修改的加载项{22181a4d-af90-4ca3-a569-faed9118d6bc}
***LOG addons.xpi:使用对已安装加载项的更改更新数据库
***LOG addons.xpi-utils:更新加载项状态
***LOG addons.xpi-utils:写入加载项列表
***LOG addons.xpi:在启动时调用引导方法firebug@software.joehewitt.com版本1.11.4
***日志加载项管理器:关闭
***LOG addons.xpi:关闭
***LOG addons.xpi-utils:关闭
***LOG addons.xpi-utils:数据库已关闭
***LOG addons.xpi:启动
***LOG addons.xpi:跳过不可用的安装位置app system local
***LOG addons.xpi:跳过不可用的安装位置应用程序系统共享
***LOG addons.xpi:忽略名称不是有效加载项ID的文件条目:
C:\Windows\TEMP\anonymous3048824074469384020webdriver配置文件\extensions\webdriver暂存
***LOG addons.xpi:检查更改
***LOG addons.xpi:未找到任何更改
***LOG addons.xpi:从加载引导作用域
C:\Windows\TEMP\anonymous3048824074469384020webdriver配置文件\extensions\firebug@software.joehewitt.com.xpi
***LOG addons.xpi:在启动时调用引导方法firebug@software.joehewitt.com版本1.11.4
***LOG addons.xpi-utils:打开数据库
位于org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:106)
位于org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:251)
位于org.openqa.selenium.remote.RemoteWebDriver。(RemoteWebDriver.java:110)
位于org.openqa.selenium.firefox.FirefoxDriver(FirefoxDriver.java:197)
位于org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:190)
位于org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:186)
位于org.openqa.selenium.firefox.FirefoxDriver(FirefoxDriver.java:103)
在pack1.downloadfile.test1(downloadfile.java:46)
在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处
位于sun.reflect.NativeMethodAccessorImpl.invoke(未知源)
在sun.reflect.DelegatingMethodAccessorImpl.invoke处(未知源)
位于java.lang.reflect.Method.invoke(未知源)
位于org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
位于org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
位于org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
位于org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
位于org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
位于org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
位于org.testng.TestRunner.privateRun(TestRunner.java:767)
位于org.testng.TestRunner.run(TestRunner.java:617)
位于org.testng.SuiteRunner.runTest(SuiteRunner.java:335)
在org.testng.SuiteRunner.runsequential上(SuiteRunner.java:330)
位于org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
运行(SuiteRunner.java:240)
位于org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
位于org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
在org.testng.testng.runSuitesSequentially上(testng.java:1224)
位于org.testng.testng.runSuitesLocally(testng.java:1149)
位于org.testng.testng.run(testng.java:1057)
位于org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
位于org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
位于org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
失败:test1
org.openqa.selenium.WebDriverException:无法连接到端口7055上的二进制FirefoxBinary(C:\Program Files(x86)\Mozilla Firefox\Firefox.exe);过程输出如下:
***LOG addons.xpi:启动
***LOG addons.xpi:跳过不可用的安装位置app system local
***日志添加