WinAppDriver连续抛出错误,因为“未知错误,操作超时”

问题描述 投票:0回答:1

我正在尝试使用WinAppDriver自动安装在Visual Studio 2019 Enterprise]中的扩展程序的UI,并且在成功完成配置和测试方案之后,WinAppDriver服务器不断抛出如下错误。

Accept: application/json, image/png
Connection: Keep-Alive
Content-Length: 169
Content-Type: application/json;charset=utf-8
Host: 127.0.0.1:4723
User-Agent: selenium/3.141.0 (.net windows)

HTTP/1.1 500 Internal Error
Content-Length: 117
Content-Type: application/json

{"status":13,"value":{"error":"unknown error","message":"Operation timed out. (Exception from HRESULT: 0x80131505)"}}

起初我的测试服已成功运行,但现在它始终抛出错误。

而且,在Visual Studio中,它记录错误为;

“消息:测试方法abc.1234.test抛出异常:System.NullReferenceException:对象引用未设置为对象的实例。“

这是我的会话的创建方式。

if (session == null)
{
TestLogger.LogInfo("Session object is null, creating new singleton object");
Connector winAppRun = new Connector();

try
 {

winAppRun.WinAppUrl = configHelper.GetWinAppDriverURL() + configHelper.GetWinAppDriverPort();
winAppRun.ProjectLocation = ConfigurationManager.AppSettings.Get("AppLocation");

AppiumOptions opt = new AppiumOptions();

opt.AddAdditionalCapability("app", winAppRun.ProjectLocation);
opt.AddAdditionalCapability("deviceName", "WindowsPC");
**session = new WindowsDriver<WindowsElement>(new Uri(winAppRun.WinAppUrl), opt, TimeSpan.FromMinutes(5));**
Thread.Sleep(TimeSpan.FromSeconds(10));

[如果有人可以解决我的问题,将不胜感激。谢谢。

我正在尝试使用WinAppDriver自动化安装在Visual Studio 2019 Enterprise中的扩展的UI,在成功完成配置和测试方案之后,WinAppDriver ...

visual-studio ui-automation desktop-application vs-unit-testing-framework winappdriver
1个回答
0
投票

您可以尝试创建desktop driver session并使用Process.Start()方法启动Visual Studio。

© www.soinside.com 2019 - 2024. All rights reserved.