iOS: WebDriverAgent tries to use port 0

Hello.

I try to run test on iOS devices, but they won’t show up in the device list.

I followed this documentation: https://docs.katalon.com/display/KD/Mobile+on+macOS

My steps so far: Connected an iPad 4 with an iMac. Share the ethernet connection of the imac with the iPad, so both use the same LAN (wifi is in another LAN).

I compiled and deployed the WebDriverAgent software on the ipad and it starts with the following messages:

2018-04-17 12:18:05.377882+0200 WebDriverAgentRunner-Runner[1722:2691470] Running tests...2018-04-17 12:18:06.490991+0200 WebDriverAgentRunner-Runner[1722:2691470] Continuing to run tests in the background with task ID 1Test Suite 'All tests' started at 2018-04-17 12:18:07.236Test Suite 'WebDriverAgentRunner.xctest' started at 2018-04-17 12:18:07.243Test Suite 'UITestingUITests' started at 2018-04-17 12:18:07.261Test Case '-[UITestingUITests testRunner]' started.   t =     0.01s Start Test at 2018-04-17 12:18:07.271   t =     0.01s Set Up2018-04-17 12:18:07.303505+0200 WebDriverAgentRunner-Runner[1722:2691470] Built at Apr  6 2018 17:29:362018-04-17 12:18:07.391173+0200 WebDriverAgentRunner-Runner[1722:2691470] ServerURLHere->http://192.168.2.3:0<-ServerURLHere2018-04-17 12:31:57.607130+0200 WebDriverAgentRunner-Runner[1722:2691470] Continuing to run tests in the background with task ID 5

So it binds to port 0, which doesn’t look right. Port 8100 is not in use.

NMAP:
PORT      STATE SERVICE  
80/tcp    open  http     
81/tcp    open  hosts2-ns
82/tcp    open  xfer     
83/tcp    open  mit-ml-dev                     
443/tcp   open  https                          
1080/tcp  open  socks                                             
3128/tcp  open  squid-http                                 
8000/tcp  open  http-alt                
8080/tcp  open  http-proxy                         
8088/tcp  open  radan-http
8888/tcp  open  sun-answerbook                     
62078/tcp open  iphone-sync

Any idea suggestion why the port is not used? When using wifi it also uses port 0.

Looking forward to your answers.

Milgrim

Explanation & solution: https://github.com/facebook/WebDriverAgent/issues/661

The USE_PORT environment variable needs to be set when running the WebDriverAgent, otherwise it defaults to 0.

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=4AE3673B-8013-4164-96F4-1702D54BB67E' test USE_PORT=8100