我试图使用WinAppDriver(https://github.com/Microsoft/WinAppDriver)自动化WinForm应用程序。
此应用程序正在使用DevExpress。我需要从DevExpress正确处理Spreadsheet或GridViews控件。我找到的唯一可能的解决方案是与Actions交互并将鼠标移动到屏幕上的特定位置。但是有两个问题:
有人可以帮我弄这个吗?
与电子表格交互的代码:
_driver.Current.FindElementByName("FormContainer").Click();
var spread = _driver.Current.FindElementByAccessibilityId("spreadsheet");
Actions ac = new Actions(_driver.Current);
ac.MoveToElement(spread).MoveByOffset(-600,-220).Click().SendKeys("11").Build().Perform();
今天遇到了同样的问题。如果您的spreadsheetcontrol
具有关联的spreadsheetnamebox
,则解决方法包括更改namebox
文本值。
例如,如果你将namebox
编辑值设置为A6
(更容易实现;-)),焦点将在A6
中的spreadheetcontrol
单元格中设置。然后,一个简单的session.Keyboard.SendKeys
将允许您更改单元格值。
您还可以使用formulabarcontrol
来读取/写入单元格内容。但是没有这两个控件,我没有找到任何其他可靠的解决方案来自动化spreadsheetcontrol
(请注意,Microsoft Excel测试自动化会出现同样的困难......)。