
今天尝试最新的webDriver与fireFox搭配:
运行代码时出现如下的问题,但是浏览器却可以打开:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port after ms at
org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:)
at com.dci.dids.selenium.SwamiRoleCreationTestCase.setUp(SwamiRoleCreationTestCase.java:)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
at java.lang.reflect.Method.invoke(Method.java:)
at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:)
at org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:)
at org.junit.internal.runners.TestClassRunner$.runUnprotected(TestClassRunner.java:)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:)
org.openqa.selenium.firefox.NotConnectedException 一般这个错误,表示webDriver与fireFox不兼容,webDriver的版本太低,但是我的WebDriver的相关jar的版本是最高的,2.25.0 。
最后发现原来是在eclipse中的webDriver没有更换成最新的jar。
目前经过测试:
webDriver2.25.0 +fireFox36.0
webDriver 2.24+fireFox34.0
可以兼容。