Forum Discussion

Ferny's avatar
Ferny
New Contributor
9 months ago

Unable to start Appium on iOS Server Side (Appium and other frameworks) job

Hello,

Was wondering if anyone else had run into this issue:

When running an iOS Server Side (Appium and other frameworks) job, I am not able to start Appium. I am using the default OSX docker image provided by BitBar:

osx-12 
13:34 up 9 mins, 1 user, load averages: 7.31 9.24 7.02 
VM Version : 12.7-2024-02-06-0913 build : 2024-02-06 01:24:05 PST

In the output for appium.log, I see only the following line: 

[ERROR] Unrecognized arguments: --base-path /wd/hub --port 4723 --log-timestamp --log-no-colors --default-capabilities {     "appium:xcodeConfigFile": "/opt/testdroid/appium.xcconfig",     "appium:udid": "00008101-0014509C2E38001E",     "appium:webDriverAgentUrl": "http://localhost:8102",     "appium:webkitDebugProxyPort": 27753,     "appium:platformVersion": "16.0",     "appium:showXcodeLog": true     }

However, I am not adding these arguments in my run-tests.sh... Below is the line I use to start Appium:

appium -U ${UDID}

I have tried a whole bunch of things including installing Appium and the xcuitest driver via my run-tests.sh, I've tried to kill all node.js processes before starting Appium when I'm ready to run my tests.

Every time, Appium fails to start, and I look into the console.log and see:

nc: connectx to localhost port 4723 (tcp) failed: Connection refused
nc: connectx to localhost port 4723 (tcp) failed: Connection refused
nc: connectx to localhost port 4723 (tcp) failed: Connection refused
nc: connectx to localhost port 4723 (tcp) failed: Connection refused
nc: connectx to localhost port 4723 (tcp) failed: Connection refused
nc: connectx to localhost port 4723 (tcp) failed: Connection refused
nc: connectx to localhost port 4723 (tcp) failed: Connection refused
nc: connectx to localhost port 4723 (tcp) failed: Connection refused
info Service is not responding..

Any help or advice would be appreciated.

  • I've managed to fix my issue, after testing out various fixes all day.

    There was some version of appium on the image, however, it would not work with the default caps that bitbar starts it with.

    Using npm list -g I also saw that there was a version of appium-xcuitest-driver installed.

    I Added the following lines to my bash script in the appropriate places:

    sudo npm uninstall -g appium-xcuitest-driver
    sudo npm uninstall -g appium
    sudo npm install -g -force appium@2.0.1
    sudo appium driver install xcuitest
    
    ...
    
    #Install coreutils for gtimeout command
    brew install coreutils
    
    sudo appium --base-path /wd/hub --port 4723 --log-timestamp --log-no-colors --default-capabilities '{"appium:xcodeConfigFile": "/opt/testdroid/appium.xcconfig", "appium:udid": "'"$UDID"'", "appium:webDriverAgentUrl": "http://localhost:8102", "appium:webkitDebugProxyPort": 27753, "appium:showXcodeLog": true}' & > appium.log
    
    #Wait up to two mins to connect to appium server
    gtimeout 120s sh -c 'until nc -z $0 $1; do sleep 1; done' localhost 4723

    I uninstalled the xcuitest driver. I left in the npm uninstall -g appium command, but it doesn't appear to do anything, so I added -force to the npm install -g -force appium@2.0.1 command (I use that specific version on my local). I can now connect to the ios device.

    If any staff see's this, is there any place I can view changelogs and/or update schedules for the default images you guys provide? It feels like every few months I have to update my run-tests.sh file to get it to work again whenever the docker image is updated.

  • Ferny's avatar
    Ferny
    New Contributor

    I would also like to add my same script was working fine on the following docker image:

    osx-12
     9:22  up 15 mins, 1 user, load averages: 3.84 6.78 6.84
    VM Version : 12.6.7-2023-09-01-0910 build : 2023-09-01 02:20:22 PDT

     

    • Ferny's avatar
      Ferny
      New Contributor

      I've managed to fix my issue, after testing out various fixes all day.

      There was some version of appium on the image, however, it would not work with the default caps that bitbar starts it with.

      Using npm list -g I also saw that there was a version of appium-xcuitest-driver installed.

      I Added the following lines to my bash script in the appropriate places:

      sudo npm uninstall -g appium-xcuitest-driver
      sudo npm uninstall -g appium
      sudo npm install -g -force appium@2.0.1
      sudo appium driver install xcuitest
      
      ...
      
      #Install coreutils for gtimeout command
      brew install coreutils
      
      sudo appium --base-path /wd/hub --port 4723 --log-timestamp --log-no-colors --default-capabilities '{"appium:xcodeConfigFile": "/opt/testdroid/appium.xcconfig", "appium:udid": "'"$UDID"'", "appium:webDriverAgentUrl": "http://localhost:8102", "appium:webkitDebugProxyPort": 27753, "appium:showXcodeLog": true}' & > appium.log
      
      #Wait up to two mins to connect to appium server
      gtimeout 120s sh -c 'until nc -z $0 $1; do sleep 1; done' localhost 4723

      I uninstalled the xcuitest driver. I left in the npm uninstall -g appium command, but it doesn't appear to do anything, so I added -force to the npm install -g -force appium@2.0.1 command (I use that specific version on my local). I can now connect to the ios device.

      If any staff see's this, is there any place I can view changelogs and/or update schedules for the default images you guys provide? It feels like every few months I have to update my run-tests.sh file to get it to work again whenever the docker image is updated.