【问题标题】:Can't run Windows Application Driver Address 'http://127.0.0.1:4723/' is already in use无法运行 Windows 应用程序驱动程序地址“http://127.0.0.1:4723/”已在使用中
【发布时间】:2022-01-08 09:00:49
【问题描述】:

已实现WinAppDriver

尝试启动 Windows 应用程序驱动程序 C#

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

错误:

地址“http://127.0.0.1:4723/”已被使用 初始化失败:0x80004005

运行 Windows 应用程序驱动程序 c# 代码时出错:

对 URL http://localhost:4723/session 的远程 WebDriver 服务器的 HTTP 请求在 60 秒后超时。

C# 代码:

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

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

运行

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

我发现 PID 是用于

TCP    0.0.0.0:4723           0.0.0.0:0              LISTENING       4

系统运行 PID

任务列表

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

Windows 应用程序驱动程序无法运行,因为某些东西已经占用了端口。 这是杀毒软件吗?你是怎么解决的?

【问题讨论】:

    标签: windows windows-application-driver


    【解决方案1】:

    最终决定只在另一个端口上运行应用程序。

    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);
    

    【讨论】:

      猜你喜欢
      • 2016-10-30
      • 2019-08-04
      • 2017-03-12
      • 1970-01-01
      • 2012-08-26
      • 1970-01-01
      • 2014-01-11
      • 2022-06-30
      • 2016-04-20
      相关资源
      最近更新 更多