Search code examples
javaappiumappium-java

starting Appium in port 4723 redirects to port 8200


Currently I am starting programmatically an Appium server with the following capabilities

        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
        capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "11.0");
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "emulator-5554");
        capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "UiAutomator2");
        capabilities.setCapability(MobileCapabilityType.APP, "apk/path");

        driver = new AndroidDriver<AndroidElement>(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);

This are logs from Appium. enter image description here

But it ends up redirecting it to port 8200 enter image description here

Anyone know why is this happening?


Solution

  • I've noticed a lot of weird behaviour when connecting to the loopback address (0.0.0.0), so it might be related to that.

    Try starting Appium by explicitly binding to localhost, which you can do with the --address argument, eg --address 127.0.0.1.

    Then, update your connection string to http://127.0.0.1:4723/wd/hub.