Selenium jar: 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: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. 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: