Could not connect to server to Appium server

I have updated my Appium v2.0.0-beta.58, and also installed a new Appium inspector.

Added all capabilities and paths. I am getting an error message when I try to start the session in Appium inspector:

"Could not connect to the server; are you sure it’s running? If you are using the browser version, also ensure your Appium server has been started with --allow-cors."

As mentioned on GitHub and some other documentation references, I tried to start the Appium server with --allow-cors by using the command: appium --allow-cors. Still, I can see the same error. and also I update my node js also. But the error is not to be resolved.

Still, I see the same issue. I updated my node.js also.

Please help me to understand what is the issue.

These are my desired capabilities:
{
“platformName”: “Android”,
“appium:platformVersion”: “11”,
“appium:deviceName”: “Xiaomi 220116SI”,
“appium:automationName”: “UiAutomator2”,
“appium:appPackage”: “com.application.user”,
“appium:appActivity”: “com.application.user.ui.activities.HomeActivity”
}

These are my Appium server details

And even I didn’t see any error details in the log also. Here I’ll attach the log details also

Last login: Mon Apr 3 16:18:33 on ttys001
iniyavanchoco@Iniyavans-MacBook-Air ~ % appium --log-level debug
[Appium] Welcome to Appium v2.0.0-beta.58
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[Appium] No drivers have been installed in /Users/iniyavanchoco. Use the “appium driver” command to install the one(s) you want to use.
[Appium] No plugins have been installed. Use the “appium plugin” command to install the one(s) you want to use.

Here(in the photo), where it says “Remote Path” delete the path and leave it empty(meaning just /)
First of all, “allow cors” won’t help you since you are not using the browser…
The default server path for appium2.X is / (without wd/hub)

Hi ido_oserovitz, Thanks for your reply.

I tried that way, but still I can see the same error.

Can you please check that

Why you change default Remote host from 127.0.0.1 (localhost) to 127.0.0.0?

1 Like

@Oleg_Guzenko is correct.
You can delete all of the followings: Remote Host, Remote Path, Remote Port (it will use the default values).
Then, make sure you start your appium server(just run appium without specifying any port) and it should work for you.

Hi Oleg, Actually I run the appium with 127.0.0.0. That’s why I change the Remote host.

And also I’ll share my appium doctor’s result and installed drivers

@ido_oserovitz Hi, Actually I didn’t specify any port to run Appium. I just run Appium by using the terminal. not in an Appium GUI. And I just reinstall the Appium inspector also. It has a default Remote host as a 127.0.0.0, not a 127.0.0.1

0.0.0.0 and 127.0.0.0 are two different ips…
I wrote here what to do: Could not connect to server to Appium server
If you’ll follow, it will work, just try it, you have nothing to lose and you asked for help…
you can change inspector’s address to: 0.0.0.0 as well. it should work.

@ido_oserovitz Thank you so much, man. It’s working now!

1 Like

But @ido_oserovitz, It’s working only on an Android studio emulator, If I try the same on Real devices, it’s not connected. I’ll share the log also, kindly check it.


Check this thread


Maybe you are not enable usb debugging. And usb debugging for Xiaomi need Xiaomi account…

1 Like

Thanks Oleg, Its working

Hi guys,
I am facing the same issue, I have kept Remote Host , Remote Path , Remote Port as default. Tried almost everything available online. Attaching the screenshots below. Let me know how can I fix this. @ido_oserovitz @Oleg_Guzenko