Kumar
Kumar

Reputation: 717

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:

  1. Start app using batch file.
  2. Click "Next >" button using coordinates with "Mouse Click".
  3. Click a text box and input some text.
  4. 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.html

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

Upvotes: 1

Views: 9319

Answers (4)

Omar Mughrabi
Omar Mughrabi

Reputation: 133

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

Upvotes: 0

Lloyd Ryan David
Lloyd Ryan David

Reputation: 117

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.

Upvotes: 0

Marco Kinski
Marco Kinski

Reputation: 342

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.

Upvotes: 0

Hariprasad
Hariprasad

Reputation: 93

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 

Upvotes: -1

Related Questions