Can't run Windows Application Driver Address 'http://127.0.0.1:4723/' is already in use

624 views Asked by At

Implemented WinAppDriver

Trying to start Windows Application Driver C#

var p = new Process();
p.StartInfo.FileName = @"C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe";                
p.Start();

Error:

Address 'http://127.0.0.1:4723/' is already in use Failed to initialize: 0x80004005

Error running it Windows Application Driver c# code:

The HTTP request to the remote WebDriver server for URL http://localhost:4723/session timed out after 60 seconds.

C# Code:

var appPath = @"ApplicationPath";
var windowsApplicationDriverUrl = "http://localhost:4723";
var appiumOptions = new AppiumOptions();
appiumOptions.AddAdditionalCapability("app", appPath);

session = new WindowsDriver<WindowsElement>(new Uri(windowsApplicationDriverUrl), appiumOptions);

Run

netstat -a -n -o | find "4723"

I find the PID is for

TCP    0.0.0.0:4723           0.0.0.0:0              LISTENING       4

The System runs the PID

tasklist

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
System Idle Process              0 Services                   0          8 K
System                           4 Services                   0      1,440 K

Windows Application driver doesn't run because something is already hogging the port. Is this anti-virus? How do you fix?

1

There are 1 answers

0
Demodave On

Ultimately decided to just run the application on another port.

ProcessStartInfo startInfo = new ProcessStartInfo(@"C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe");
startInfo.Arguments = "28399";                
var p = Process.Start(startInfo);

Console.WriteLine("start");
var appPath = @"ApplicationPath";
var windowsApplicationDriverUrl = "http://localhost:28399";
var appiumOptions = new AppiumOptions();
appiumOptions.AddAdditionalCapability("app", appPath);

session = new WindowsDriver<WindowsElement>(new Uri(windowsApplicationDriverUrl), appiumOptions);