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

问题描述 投票:0回答:4

Robot Framework 中 AutoIt 库的“Control Click”关键字的语法是什么?步骤 1、2 和 3 有效:

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

使用“Control Click”我得到:

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

机器人文件:

***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:\Users est\Desktop\RFW with AutoIt>pybot auto.robot =================================================== ============================== 自动 =================================================== ============================== 测试用例1
。 C:\Users est\Desktop\RFW with AutoIt>echo off testcase1
|失败 | com_error: (-2147352561, '参数不可选。', 无, 没有任何) -------------------------------------------------- ---------------------------- 自动
|失败 | 1 项关键测试,0 项通过,1 项失败 1 项测试总计,0 项通过,1 项 失败的 =================================================== ============================ 输出:C:\Users est\Desktop\RFW with AutoIt\output.xml 日志:
C:\Users est\Desktop\RFW with AutoIt\log.html 报告: C:\Users est\Desktop\RFW with AutoIt eport.html

C:\Users est\Desktop\RFW with AutoIt>

autoit robotframework
4个回答
0
投票
Control Click  ${title}  ${EMPTY}  [CLASS:Button;TEXT:Next >]

参数名称似乎只是文档。

如果没有 controlID(第三个参数),您将收到之前的错误。


0
投票

我认为您使用控制单击的方式是错误的。您应该至少用至少两 (2) 个空格分隔参数,而不是用“,”。所以,这将是:

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

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


0
投票

嗨,在我能够使用反斜杠“\”作为分隔符而不使用任何属性或标题只是证明“AutoIt V3 窗口信息”中的按钮名称(ClassnameNN 值)之前,我已经尝试了很多事情:

 Control Click       \    \   Button1

-1
投票

我认为只需从代码中删除参数名称即可。 strButton=,strTitle=,nX=, nY=,nClicks= 在 RF 中只需要这样写...

testcase1
Run                 ${Run_batchfile}
Wait For Active Window      ${Title}        TimeOut=140 
Mouse Click    LEFT    887    523    2    1000 
© www.soinside.com 2019 - 2024. All rights reserved.