WinAppDriver:桌面应用程序的启动工作正常,但最近出现问题
WinAppDriver: Launching of desktop application was working fine, but of late its having issues
当我使用 winAppDriver
自动化时,桌面应用程序的启动工作正常。
最近我发现这些测试失败了。
它在这一行失败了,
notepadsession = new WindowsDriver(new Uri("http://127.0.0.1:4723"), desiredcapabilities);
我尝试了两种代码,但仍然失败:
var currentWindowHandle = notepadsession.CurrentWindowHandle;
Thread.Sleep(TimeSpan.FromSeconds(5));
var allWindowHandles = notepadsession.WindowHandles;
notepadsession.SwitchTo().Window(allWindowHandles[0]);
if (notepadsession.CurrentWindowHandle != notepadsession.WindowHandles.Last())
{
notepadsession.SwitchTo().Window(notepadsession.WindowHandles.Last());
}
注意:加载桌面应用程序大约需要 40-50 秒。
非常感谢这方面的任何帮助。
谢谢
下面的代码解决了问题
notepadsession = new WindowsDriver(new Uri("http://127.0.0.1:4723"), desiredcapabilities);
Thread.Sleep(5000);
notepadsession.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);
当我使用 winAppDriver
自动化时,桌面应用程序的启动工作正常。
最近我发现这些测试失败了。
它在这一行失败了,
notepadsession = new WindowsDriver(new Uri("http://127.0.0.1:4723"), desiredcapabilities);
我尝试了两种代码,但仍然失败:
var currentWindowHandle = notepadsession.CurrentWindowHandle;
Thread.Sleep(TimeSpan.FromSeconds(5));
var allWindowHandles = notepadsession.WindowHandles;
notepadsession.SwitchTo().Window(allWindowHandles[0]);
if (notepadsession.CurrentWindowHandle != notepadsession.WindowHandles.Last())
{
notepadsession.SwitchTo().Window(notepadsession.WindowHandles.Last());
}
注意:加载桌面应用程序大约需要 40-50 秒。
非常感谢这方面的任何帮助。
谢谢
下面的代码解决了问题
notepadsession = new WindowsDriver(new Uri("http://127.0.0.1:4723"), desiredcapabilities);
Thread.Sleep(5000);
notepadsession.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);