'How to click a button using "Control Click" keyword?
What is the syntax of AutoIt library's "Control Click" keyword in Robot Framework? Step 1, 2 and 3 are working:
- Start app using batch file.
- Click "Next >" button using coordinates with "Mouse Click".
- Click a text box and input some text.
- Click "Next >" button.
Using "Control Click" I am getting :
com_error: (-2147352561, 'Parameter not optional.', None, None)
Robot file:
***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
Run time logs:
C:\Users\test\Desktop\RFW with AutoIt>pybot auto.robot ============================================================================== Auto ============================================================================== testcase1
. C:\Users\test\Desktop\RFW with AutoIt>echo off testcase1
| FAIL | com_error: (-2147352561, 'Parameter not optional.', None, None) ------------------------------------------------------------------------------ Auto
| FAIL | 1 critical test, 0 passed, 1 failed 1 test total, 0 passed, 1 failed ============================================================================== Output: C:\Users\test\Desktop\RFW with AutoIt\output.xml Log:
C:\Users\test\Desktop\RFW with AutoIt\log.html Report: C:\Users\test\Desktop\RFW with AutoIt\report.htmlC:\Users\test\Desktop\RFW with AutoIt>
Solution 1:[1]
Control Click ${title} ${EMPTY} [CLASS:Button;TEXT:Next >]
It seems that the parameter names are documentation only.
Without the controlID (third parameter) youre getting the previous error.
Solution 2:[2]
The way you used control click is wrong I think. You should have at least separated the arguments with at least two (2) spaces, not with ", ". So, this would be:
Control Click strTitle=${Title} strText=${Title} strControl=1 strButton=Next > nNumClicks=2 nX=888 nY=524
In my code, I used four (4) spaces, which what Robot Framework recommends.
Solution 3:[3]
Hi have tried many many things before I was able to get it work using the back slash "\" as separator without any attributes or titles just proving the button name (ClassnameNN value) from "AutoIt V3 Window info":
Control Click \ \ Button1
Solution 4:[4]
I think just Remove the Arguments name from your code ie. strButton=,strTitle=,nX=, nY=,nClicks= In RF only need to put like this...
testcase1
Run ${Run_batchfile}
Wait For Active Window ${Title} TimeOut=140
Mouse Click LEFT 887 523 2 1000
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Lloyd Ryan David |
Solution 3 | Omar Mughrabi |
Solution 4 |