Unable to connect to "http://localhost:4723/"

I used webdriverio framework with appium2.0.0-beta.57

when I run my automation
I got this error
0-11] at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
[0-11] 2023-04-11T01:50:58.202Z ERROR @wdio/runner: Error: Failed to create session.
[0-11] Unable to connect to “http://localhost:4723/”, make sure browser driver is running on that address.
[0-11] If you use services like chromedriver see initialiseServices logs above or in wdio.log file as the service might had problems to start the driver.

before appium2, I was using appium1.22

I was able to run the automation locally in the iOS Simulator with the desired cap
platformName: ‘iOS’,
maxInstances: 1,
// For W3C the appium capabilities need to have an extension prefix
// This is appium: for all Appium Capabilities which can be found here
// http://appium.io/docs/en/writing-running-appium/caps/
‘appium:deviceName’: ‘iPhone 14 Pro’,
‘appium:platformVersion’: ‘16.2’,
‘appium:orientation’: ‘PORTRAIT’,
‘appium:automationName’: ‘XCUITest’,
// The path to the app
‘appium:app’: join(process.cwd(), ‘./tests/apps/nativeIntegration.app’),
// Read the reset strategies very well, they differ per platform, see
// http://appium.io/docs/en/writing-running-appium/other/reset-strategies/
‘appium:noReset’: false,
‘appium:newCommandTimeout’: 500,
// ‘appium:unicodeKeyboard’: true,
// ‘appium:resetKeyboard’: true
},

now I got the error
I am not sure why it point to chromedriver when it’s using appium?

can I know where is the appium server log in the new appium2?

Maybe, you need to change address to http://localhost:4723/wd/hub

https://appium.github.io/appium/docs/en/2.0/guides/migrating-1-to-2/

the issue is the node version
need to use v16.x

nice. just wonder what was before?

1 Like

The Solution of this problem is,

The appium package is not installed in your code.

First check the appium version on global level
COMMAND : appium -version

and install same version of appium in your project by npm command
EX: npm install -g appium@next

This will solve the problem

hi idrish_momin

I got this error
2023-10-13T09:18:48.870Z ERROR webdriver: RequestError: connect ECONNREFUSED 127.0.0.1:4723

67[0-0] at ClientRequest. (file:///Users/runner/work/sh-usermanagement-native-poc/sh-usermanagement-native-poc/node_modules/got/dist/source/core/index.js:790:107)

68[0-0] at Object.onceWrapper (node:events:632:26)

69[0-0] at ClientRequest.emit (node:events:529:35)

70[0-0] at ClientRequest.emit (node:domain:489:12)

71[0-0] at Socket.socketErrorListener (node:_http_client:501:9)

72[0-0] at Socket.emit (node:events:517:28)

73[0-0] at Socket.emit (node:domain:489:12)

74[0-0] at emitErrorNT (node:internal/streams/destroy:151:8)

75[0-0] at emitErrorCloseNT (node:internal/streams/destroy:116:3)

76[0-0] at processTicksAndRejections (node:internal/process/task_queues:82:21)

77[0-0] at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)

78[0-0] 2023-10-13T09:18:48.871Z ERROR @wdio/runner: Error: Failed to create session.

79[0-0] Unable to connect to “http://127.0.0.1:4723/”, make sure browser driver is running on that address.

80[0-0] It seems like the service failed to start or is rejecting any connections.

81[0-0] a