Friday, April 17, 2020

Appium Windows Automation: Options for running WinAppDriver.exe


The screenshot above shows installation folder of Windows Application Driver (WinAppDriver/WAD). WinAppDriver is a free to use UI automation technology by Microsoft, it is based on Appium and WebDriver standard.

To learn more about WinAppDriver, please visit the following course link:

https://www.udemy.com/course/appium-winappdriver-automation-testing/?referralCode=ED22C3A4CE5BB5E22E53

You need to know what's the importance of WinAppDriver.exe in UI automation based on [Appium] WinAppDriver.

Open file explorer and type path of WinAppDriver installation folder here.
Default installation path of WinAppDriver the path “C:\Program Files (x86)\Windows Application Driver”.
Inside the installation folder, you can see WinAppDriver.exe file alongside other binaries.
The WinAppDriver.exe is the heart of UI automation on the [Appium] WinAppDriver platform.

To perform UI automation with WinAppDriver, the WinAppDriver.exe file must be running on the target machine.

If you double click to start it[WinAppDriver.exe], you'll see it’s a console application.
Before proceeding further, let me repeat again, your WinAppDriver based UI automation will fail if the file WinAppDriver.exe is not running.



The WinAppDriver default port 4723. WinAppDriver is listening for incoming automation commands using http protocol.

It is listening for Appium automation commands on port number 4723.

Your script(C#, Java, JavaScript, Python, Ruby) tells the WinAppdriver what automation operation it wants to be performed and automation on the machine is performed by this WinAppDriver.exe.
The test automation script and the driver can be either on the same machine or on different machines.

Your scripts will fail if the WinAppDriver is not reachable through the port number which you specify in your script.

Windows Firewall can cause serious pain in this regard sometimes.

If let’s suppose the port number is already in use by another program, you can specify it through the command line.

For example, if we open the command prompt.

Next, type the full path of WinAppDriver here and press enter.

i.e.
C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe 21000

Here, I can simply type a different port number after the space, as a command line parameter.

Please note that the port number must be greater than 1024 and less than 65335.

You can type 21000 and hit Enter key.


The server will start running on this port now.

It’s better to let the WinAppDriver run on the default port, 4723.

You may create a shortcut to the WinAppDriver.exe on your desktop as well.

It is also possible to specify a different port number in the "target" field of a shortcut which you've created.