I am new to selenium testing. I am trying to run this very basic use case , in which I am opening firefox browser through selenium webdriver but it is giving me org.openqa.selenium.firefox.NotConnectedException. I have tried all solutions given in other similar post but nothing seems to be working. Also if I reinstall firefox , it is working for first time and then it is not working.
Selenium version : 2.48 Firefox : 33.1 Windows :10
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.SkipException;
import org.testng.annotations.Test;
public class TestNGPro {
@Test
public void f() {
WebDriver driver = new FirefoxDriver();
driver.get("http://newtours.demoaut.com/");
driver.quit();
}
@Test
public void c_f1(){
Assert.fail();
}
@Test
public void a_f2(){
Assert.assertTrue(true);
}
@Test(priority = 4)
public void e_f4(){
Assert.fail();
}
@Test
public void g_f3(){
throw new SkipException("skipping b_test");
}
}
Below is the error in console I am getting :
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:122)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:117)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
at TestNGPro.TestNGPro.f(TestNGPro.java:14)
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:108)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:744)
at org.testng.TestRunner.run(TestRunner.java:602)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
at org.testng.TestNG.runSuites(TestNG.java:1144)
at org.testng.TestNG.run(TestNG.java:1115)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
PASSED: a_f2
FAILED: c_f1
java.lang.AssertionError: null
at org.testng.Assert.fail(Assert.java:93)
at org.testng.Assert.fail(Assert.java:100)
at TestNGPro.TestNGPro.c_f1(TestNGPro.java:21)
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:108)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:744)
at org.testng.TestRunner.run(TestRunner.java:602)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
at org.testng.TestNG.runSuites(TestNG.java:1144)
at org.testng.TestNG.run(TestNG.java:1115)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
FAILED: f
org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 7055; process output follows:
tartup
1490296405449 addons.xpi INFO Mapping {4ED1F68A-5463-4931-9384-8FFF5ED91D92} to C:\Program Files (x86)\McAfee\SiteAdvisor\saffplg.xpi
1490296405449 addons.xpi DEBUG Skipping unavailable install location app-system-local
1490296405449 addons.xpi DEBUG Skipping unavailable install location app-system-share
1490296405450 addons.xpi INFO Mapping {972ce4c6-7e08-4474-a285-3208198ce6fd} to C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{972ce4c6-7e08-4474-a285-3208198ce6fd}
1490296405452 addons.xpi INFO Mapping fxdriver@googlecode.com to C:\Users\o2r-team\AppData\Local\Temp\anonymous7601333361719984095webdriver-profile\extensions\fxdriver@googlecode.com
1490296405452 addons.xpi DEBUG Ignoring file entry whose name is not a valid add-on ID: C:\Users\o2r-team\AppData\Local\Temp\anonymous7601333361719984095webdriver-profile\extensions\webdriver-staging
1490296405452 addons.xpi DEBUG checkForChanges
1490296405466 addons.xpi DEBUG Directory state JSON differs: cache [] state [{"name":"winreg-app-global","addons":{"{4ED1F68A-5463-4931-9384-8FFF5ED91D92}":{"descriptor":"C:\\Program Files (x86)\\McAfee\\SiteAdvisor\\saffplg.xpi","mtime":1489672943735}}},{"name":"app-global","addons":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"descriptor":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}","mtime":1490295869875,"rdfTime":1415924238000}}},{"name":"app-profile","addons":{"fxdriver@googlecode.com":{"descriptor":"C:\\Users\\o2r-team\\AppData\\Local\\Temp\\anonymous7601333361719984095webdriver-profile\\extensions\\fxdriver@googlecode.com","mtime":1490296403775,"rdfTime":1490296403740}}}]
1490296405476 addons.xpi-utils DEBUG Opening XPI database C:\Users\o2r-team\AppData\Local\Temp\anonymous7601333361719984095webdriver-profile\extensions.json
1490296405478 addons.xpi DEBUG New add-on fxdriver@googlecode.com installed in app-profile
*** Blocklist::_loadBlocklistFromFile: blocklist is disabled
1490296405634 addons.xpi-utils DEBUG Make addon app-profile:fxdriver@googlecode.com visible
1490296405636 DeferredSave.extensions.json DEBUG Save changes
1490296405636 DeferredSave.extensions.json DEBUG Save changes
1490296405637 addons.xpi DEBUG New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global
1490296405641 addons.xpi-utils DEBUG Make addon app-global:{972ce4c6-7e08-4474-a285-3208198ce6fd} visible
1490296405641 DeferredSave.extensions.json DEBUG Save changes
1490296405641 DeferredSave.extensions.json DEBUG Save changes
1490296405642 addons.xpi DEBUG New add-on {4ED1F68A-5463-4931-9384-8FFF5ED91D92} installed in winreg-app-global
1490296405647 addons.xpi-utils DEBUG Make addon winreg-app-global:{4ED1F68A-5463-4931-9384-8FFF5ED91D92} visible
1490296405647 DeferredSave.extensions.json DEBUG Save changes
1490296405647 DeferredSave.extensions.json DEBUG Save changes
1490296405664 addons.xpi DEBUG Updating database with changes to installed add-ons
1490296405664 addons.xpi-utils DEBUG Updating add-on states
1490296405666 addons.xpi-utils DEBUG Writing add-ons list
1490296405675 addons.manager DEBUG Registering shutdown blocker for XPIProvider
1490296405675 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager
1490296405677 addons.manager DEBUG Registering shutdown blocker for OpenH264Provider
1490296405677 addons.manager DEBUG Registering shutdown blocker for PluginProvider
1490296406713 DeferredSave.extensions.json DEBUG Starting timer
1490296406763 DeferredSave.extensions.json DEBUG Starting write
1490296407116 DeferredSave.extensions.json DEBUG Write succeeded
1490296407116 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 16
System JS : ERROR (null):0 - uncaught exception: [object Object]
JavaScript error: chrome://fxdriver/content/server.js, line 61: NS_ERROR_XPC_CI_RETURNED_FAILURE: Component returned failure code: 0x80570015 (NS_ERROR_XPC_CI_RETURNED_FAILURE) [nsIJSCID.createInstance]
1490296408825 addons.manager DEBUG Registering shutdown blocker for <unnamed-provider>
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:55:52'
System info: host: 'LAPTOP-P785QGVF', ip: '192.168.1.18', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:134)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:117)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
at TestNGPro.TestNGPro.f(TestNGPro.java:14)
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:108)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:744)
at org.testng.TestRunner.run(TestRunner.java:602)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
at org.testng.TestNG.runSuites(TestNG.java:1144)
at org.testng.TestNG.run(TestNG.java:1115)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
tartup
1490296405449 addons.xpi INFO Mapping {4ED1F68A-5463-4931-9384-8FFF5ED91D92} to C:\Program Files (x86)\McAfee\SiteAdvisor\saffplg.xpi
1490296405449 addons.xpi DEBUG Skipping unavailable install location app-system-local
1490296405449 addons.xpi DEBUG Skipping unavailable install location app-system-share
1490296405450 addons.xpi INFO Mapping {972ce4c6-7e08-4474-a285-3208198ce6fd} to C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{972ce4c6-7e08-4474-a285-3208198ce6fd}
1490296405452 addons.xpi INFO Mapping fxdriver@googlecode.com to C:\Users\o2r-team\AppData\Local\Temp\anonymous7601333361719984095webdriver-profile\extensions\fxdriver@googlecode.com
1490296405452 addons.xpi DEBUG Ignoring file entry whose name is not a valid add-on ID: C:\Users\o2r-team\AppData\Local\Temp\anonymous7601333361719984095webdriver-profile\extensions\webdriver-staging
1490296405452 addons.xpi DEBUG checkForChanges
1490296405466 addons.xpi DEBUG Directory state JSON differs: cache [] state [{"name":"winreg-app-global","addons":{"{4ED1F68A-5463-4931-9384-8FFF5ED91D92}":{"descriptor":"C:\\Program Files (x86)\\McAfee\\SiteAdvisor\\saffplg.xpi","mtime":1489672943735}}},{"name":"app-global","addons":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"descriptor":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}","mtime":1490295869875,"rdfTime":1415924238000}}},{"name":"app-profile","addons":{"fxdriver@googlecode.com":{"descriptor":"C:\\Users\\o2r-team\\AppData\\Local\\Temp\\anonymous7601333361719984095webdriver-profile\\extensions\\fxdriver@googlecode.com","mtime":1490296403775,"rdfTime":1490296403740}}}]
1490296405476 addons.xpi-utils DEBUG Opening XPI database C:\Users\o2r-team\AppData\Local\Temp\anonymous7601333361719984095webdriver-profile\extensions.json
1490296405478 addons.xpi DEBUG New add-on fxdriver@googlecode.com installed in app-profile
*** Blocklist::_loadBlocklistFromFile: blocklist is disabled
1490296405634 addons.xpi-utils DEBUG Make addon app-profile:fxdriver@googlecode.com visible
1490296405636 DeferredSave.extensions.json DEBUG Save changes
1490296405636 DeferredSave.extensions.json DEBUG Save changes
1490296405637 addons.xpi DEBUG New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global
1490296405641 addons.xpi-utils DEBUG Make addon app-global:{972ce4c6-7e08-4474-a285-3208198ce6fd} visible
1490296405641 DeferredSave.extensions.json DEBUG Save changes
1490296405641 DeferredSave.extensions.json DEBUG Save changes
1490296405642 addons.xpi DEBUG New add-on {4ED1F68A-5463-4931-9384-8FFF5ED91D92} installed in winreg-app-global
1490296405647 addons.xpi-utils DEBUG Make addon winreg-app-global:{4ED1F68A-5463-4931-9384-8FFF5ED91D92} visible
1490296405647 DeferredSave.extensions.json DEBUG Save changes
1490296405647 DeferredSave.extensions.json DEBUG Save changes
1490296405664 addons.xpi DEBUG Updating database with changes to installed add-ons
1490296405664 addons.xpi-utils DEBUG Updating add-on states
1490296405666 addons.xpi-utils DEBUG Writing add-ons list
1490296405675 addons.manager DEBUG Registering shutdown blocker for XPIProvider
1490296405675 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager
1490296405677 addons.manager DEBUG Registering shutdown blocker for OpenH264Provider
1490296405677 addons.manager DEBUG Registering shutdown blocker for PluginProvider
1490296406713 DeferredSave.extensions.json DEBUG Starting timer
1490296406763 DeferredSave.extensions.json DEBUG Starting write
1490296407116 DeferredSave.extensions.json DEBUG Write succeeded
1490296407116 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 16
System JS : ERROR (null):0 - uncaught exception: [object Object]
JavaScript error: chrome://fxdriver/content/server.js, line 61: NS_ERROR_XPC_CI_RETURNED_FAILURE: Component returned failure code: 0x80570015 (NS_ERROR_XPC_CI_RETURNED_FAILURE) [nsIJSCID.createInstance]
1490296408825 addons.manager DEBUG Registering shutdown blocker for <unnamed-provider>
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:122)
... 32 more
FAILED: e_f4
java.lang.AssertionError: null`
at org.testng.Assert.fail(Assert.java:93)
at org.testng.Assert.fail(Assert.java:100)
at TestNGPro.TestNGPro.e_f4(TestNGPro.java:32)
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:108)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:744)
at org.testng.TestRunner.run(TestRunner.java:602)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
at org.testng.TestNG.runSuites(TestNG.java:1144)
at org.testng.TestNG.run(TestNG.java:1115)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
SKIPPED: g_f3
org.testng.SkipException: skipping b_test
at TestNGPro.TestNGPro.g_f3(TestNGPro.java:37)
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:108)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:744)
at org.testng.TestRunner.run(TestRunner.java:602)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
at org.testng.TestNG.runSuites(TestNG.java:1144)
at org.testng.TestNG.run(TestNG.java:1115)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
===============================================
Default test
Tests run: 5, Failures: 3, Skips: 1
===============================================
===============================================
Default suite
Total tests run: 5, Failures: 3, Skips: 1
====
===========================================
For selenium version 2.48 it supports up to Firefox version 41 try changing Firefox version. From here install Firefox v41.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.