WinAppDriver continuously throws an error as 'Unknown error, Operation timed out'

1

I'm trying to automate UI's of an extension installed in Visual Studio 2019 Enterprise using WinAppDriver and after all the successful completion of configurations and test scenarios, the WinAppDriver server keeps throwing an error as below.

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)"}}

Initially my test suit was successfully run but, now it keeps throwing above error.

Also, in the Visual Studio it logs an error as;

"Message: Test method abc.1234.test threw exception: System.NullReferenceException: Object reference not set to an instance of an object."

This is how my session is created.

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

If some one can give a solution for my issue, it would be highly appreciated. Thank you.

visual-studio
ui-automation
desktop-application
vs-unit-testing-framework
winappdriver
asked on Stack Overflow Dec 3, 2019 by hiran91 • edited Dec 4, 2019 by hiran91

1 Answer

0

You can try to create a desktop driver session and start your Visual Studio using Process.Start() method.

You can also try to open the Visual Studio window first and then to attach your driver to the window.

answered on Stack Overflow Dec 16, 2019 by shatulsky

User contributions licensed under CC BY-SA 3.0