我正在尝试使用 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));
如果有人可以为我的问题提供解决方案,将不胜感激。谢谢你。