如何使用"Control Click"关键字单击按钮?



AutoIt库的"Control Click"机器人框架中的关键词?步骤1、2和3正在工作:

  1. 使用批处理文件启动应用程序。
  2. 点击"下一步">"按钮使用坐标"鼠标点击"
  3. 单击文本框,输入文本。
  4. 点击"下一步">"按钮。

使用"Control Click"我得到:

com_error:(-2147352561, '参数不可选。', None, None)

机器人文件:

***Settings***
Library     AutoItLibrary
Library     Collections
Library     String
*** Variables ***
${Run_batchfile}        C:\Users\test\Desktop\software_install.bat
${Title}                Setup - test software
***Test Cases***
testcase1
    Run                 ${Run_batchfile}
    Wait For Active Window      ${Title}        TimeOut=140
    Mouse Click         strButton=LEFT, nX=887, nY=523, nClicks=2, nSpeed=1000
    Mouse Click         strButton=LEFT, nX=456, nY=225, nClicks=1, nSpeed=-1
    Wait For Active Window      ${Title}
    Send                strSendText=, c:\test_te
    Control Click       strTitle=${Title}, strText=${Title}, strControl=1, strButton=Next >, nNumClicks=2, nX=888, nY=524

运行时日志:

C:UserstestDesktopRFW with AutoIt>pybot auto.robot============================================================================== 汽车============================================================================== testcase1
。C:UserstestDesktopRFW with AutoIt>echo off testcase1
| FAIL | com_error:(-2147352561, '参数不可选。",没有,没有一个)------------------------------------------------------------------------------ 汽车
| FAIL | 1个关键测试,0个通过,1个失败失败的============================================================================== 输出:C:UserstestDesktopRFW AutoIt output.xml日志:
C:UserstestDesktopRFW with AutoItlog.html报告:C:UserstestDesktopRFW with AutoItreport.html

C:UserstestDesktopRFW with autoit

Control Click  ${title}  ${EMPTY}  [CLASS:Button;TEXT:Next >]

参数名似乎只是文档。

如果没有controllid(第三个参数),您将得到前一个错误

我认为你使用control click的方式是错误的。您应该至少用两(2)个空格分隔参数,而不是用","。因此,这将是:

Control Click strTitle=${Title} strText=${Title} strControl=1 strButton=Next > nNumClicks=2 nX=888 nY=524

在我的代码中,我使用了Robot Framework推荐的四(4)个空格。

在我能够使用反斜杠""作为分隔符而没有任何属性或标题只是证明按钮名称(ClassnameNN值)从"AutoIt V3窗口信息"之前,我已经尝试了很多东西:

 Control Click              Button1

我认为只是从你的代码中删除参数名称。strButton=,strTitle=,nX=, nY=,nClicks= In RF只需要这样放…

testcase1
Run                 ${Run_batchfile}
Wait For Active Window      ${Title}        TimeOut=140 
Mouse Click    LEFT    887    523    2    1000