使用AutoIt C#Wrapper输入ComboBox值

时间:2015-11-23 16:32:18

标签: c# winforms autoit autoit-c#-wrapper

我正在使用AutoIt在C#WinForms应用程序上运行自动化测试。以前,使用AutoIt代码我可以选择这样的ComboBox值:

_GUICtrlComboBox_SelectString($hCalendarYearComboBox, $oProject.calendarYear)

但是,我现在正在尝试使用AutoIt C#包装器编写相同的代码,但我无法实现它。首先,我没有看到任何使用GUICtrlComboBox方法的方法。作为替代方案,我尝试使用ControlCommand函数,如下所示:

_autoit.ControlCommand("Main Window Text", "", "[NAME:calendarYearComboBox]", "2015 Calendar Year");

这不会设置正确的ComboBox文本。我还尝试先获得句柄:

var calYearHandle = _autoit.ControlGetHandle("Main Window Text", "", "[NAME:calendarYearComboBox]");
_autoit.ControlCommand("Main Window Text", "", calYearHandle, "2015 Calendar Year");

我搜索了AutoIt论坛,这些论坛通常非常有帮助,但我找不到任何关于使用C#包装器设置ComboBox值的信息。有什么方法可以使用C#包装器使用_GUICtrlComboBox_SelectString方法,如果没有,我的ControlCommand语句有什么问题吗?

0 个答案:

没有答案