Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
482 views
in Technique[技术] by (71.8m points)

junit - org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms

I'm trying to run a Junit Test case which i exported from Selenium IDE. Im getting above exception.I'm using Windows XP,Firefox 20.0.1,and using selenium-server-standalone-2.28.0.jar.Upon run, a blank Firefox window is opened. When I close that window i get below exception in console

 org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms at
 org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:96)
 at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:142)
 at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:80)
 at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:121)
 at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:77)
 at com.dci.dids.selenium.SwamiRoleCreationTestCase.setUp(SwamiRoleCreationTestCase.java:20)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
 at org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
 at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
 at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
 at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
 at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
 at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
 at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
 at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
 at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

This exception in JUnit Failure trace

 org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/usr/bin/firefox) on port 7055; process output follows: * LOG addons.xpi: startup LOG addons.xpi: Ignoring file entry whose name is not a valid add-on ID:
 /tmp/anonymous5690381165464188533webdriver-profile/extensions/webdriver-staging LOG addons.xpi: checkForChanges * LOG addons.xpi: No changes found

 System info: os.name: 'Linux', os.arch: 'i386', os.version: '3.2.0-23-generic-pae', java.version: '1.6.0_38' Driver info: driver.version:
 FirefoxDriver at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:108)
 at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:142)
 at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:80)
 at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:121)
 at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:77)
 at com.dci.dids.selenium.SwamiRoleCreationTestCase.setUp(SwamiRoleCreationTestCase.java:20)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
 at org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
 at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
 at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
 at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
 at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
 at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
 at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
 at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
 at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:96) ... 25 more

 java.lang.NullPointerException at com.dci.dids.selenium.SwamiRoleCreationTestCase.tearDown(SwamiRoleCreationTestCase.java:47)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
 at org.junit.internal.runners.BeforeAndAfterRunner.runAfters(BeforeAndAfterRunner.java:65)
 at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:37)
 at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
 at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
 at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
 at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
 at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
 at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
 at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Your version of Selenium is probably not compatible with your version of Firefox. Try installing an older Firefox version.

  1. Before installing and older version, go into Firefox and turn off the automatic update option.

    Firefox --> Options --> Options --> Advanced --> Update --> Check for updates, but let me choose to install them

  2. Go here and install and older version. https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/

    You don't have to uninstall Firefox, just install the version you want to install. You may have to try a few versions until you get the right one.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...