Saturday, March 7, 2020

How to Change WinAppDriver Port Number?


The WinAppDriver, popularly known as Windows Application Driver is a UI automation engine that listens for incoming requests on port number 4782 by default.

Appium WinAppDriver UI Automation Testing Windows Apps in C#


You can see what port the WinAppDriver is listening to at any given moment when it is running; the port number is shown on the console.

WinAppDriver default port

But other than that, if you want to run the WinAppDriver on a different port number than the default, you can specify the port number in the command line arguments.
An example will be:

WinAppDriver.exe 28399

A screenshot is given below FYI.

Windows Application Driver (WAD) WinAppDriver.Exe Port Number Parameter cmd
WinAppDriver.exe port number in command line

How to specify a different port number in the shortcut?

If you've created a shortcut to WinAppDriver.exe on your desktop, you can easily go and add the port number after the exe file path in the Target field.
An example screenshot is given below to show how to set a different Windows Application Driver (WAD) port number for the desktop shortcut:


Windows Application Driver (WAD) WinAppDriver.Exe Port Number Parameter in desktop shortcut
WinAppDriver Shortcut Port Number Change
Suppose you're using Azure DevOps and want to run the WinAppDriver on your self-hosted agent or Azure VM but with a different port number. You can specify this in the pipeline task parameters. The screenshot of the setting of the Azure DevOps pipeline WinAppDriver task is shown below. as an example

WinAppDriver Azure DevOps Pipeline Task Settings Command line arguments to change port number in UI Automation Testing
WinAppDriver Azure DevOps Pipeline Task Settings