robotframework-SikuliLibrary icon indicating copy to clipboard operation
robotframework-SikuliLibrary copied to clipboard

Is there any way to click relative coordinates using SikuliLibrary?

Open romuluc opened this issue 7 years ago • 8 comments

romuluc avatar Jun 06 '18 12:06 romuluc

@romuluc , "click" operation support offset. http://rainmanwy.github.io/robotframework-SikuliLibrary/doc/SikuliLibrary.html#Click

Is it what you want?

rainmanwy avatar Jun 13 '18 03:06 rainmanwy

@rainmanwy I think he wants to click in a certain position in the screen, relative to where the mouse is currently at. For instance, if the mouse is in position 1023x and 730y, He would like to have a keyword to move the mouse 10 pixels to the right, and 2 up. Hope I was clear.

andreguilhon avatar Dec 10 '18 17:12 andreguilhon

hello, I also have a question related to this. Can I use both SeleniumLibrary and SikuliLibrary in same test case? Looks like this is not working. In test setup I've already do set library search order SeleniumLibrary SikuliLibrary but looks like test only use SikuliLibrary keyword not SeleniumLibrary keyword. Any solution to use both libraries in same test case? Thx!

*** Test Cases *** Test1 #here I am using SikuliLibrary to wait and click as SeleniumLibrary xpath element not working. Add Image Path ${IMAGE_DIR} Set Selenium Speed ${speed} open browser ${testUrl} ${browser} wait until screen contain myimg1.png click myimg1.png

#here I want to use SeleniumLibrary keyword.
input text  xpath=//input[@name='userid']  testuser

This is the error that I am getting. SikuliX: wait: ImageMissing: P(xpath=//input[@name='userid'].png -- not valid!) S: 0.7

aedahh avatar May 23 '19 18:05 aedahh

You are mixing things up, aedahh. Try to use this keyword, it takes as arguments the object you want to click (xpath=//input[@name='userid']), an optional X offset and an optional Y offset (it is meant to be used to "correct" browsers header).

Mouse Move
    [Arguments]    ${OBJETO}    ${X_OFF}=0    ${Y_OFF}=0
    ${xmax}     ${ymax}=   Get Resolution
    ${x}=   Get Horizontal Position     ${OBJETO}
    ${y}=   Get Vertical Position   ${OBJETO}
    ${width}	${height} =	Get Element Size    ${OBJETO}
    Click on coordinates    ${x}    ${y}    0 # 0 is the number of clicks to be given, 0 means it will only move the mouse.

andreguilhon avatar May 23 '19 19:05 andreguilhon

hi andreguilhon, that is my intention, I want to use both both SeleniumLibrary and SikuliLibrary in same test case, is that possible? I prefer to use SeleniumLibrary when possible, however sometimes manipulate objects using xpath does not work so I use image (SikuliLibrary). Thx

aedahh avatar May 23 '19 20:05 aedahh

@aedahh , if there is keyword confliction, could add lib name when calling keyword. For example:

SeleniumLibrary.click
SikuliLibrary.click

rainmanwy avatar May 24 '19 00:05 rainmanwy

I think I got what @aedahh wants. You are mixing things up, the second parameter for sikuli input text is an image, not an xpath. Sikuli doesn't understand xpath or any other selenium/web locator. If I got it right, you have already clicked on the textbox you want, and if that is true, you could use input text ${EMPTY} testuser . This will make Sikuli just to write testuser where the focus is.

andreguilhon avatar May 24 '19 11:05 andreguilhon

Thanks rainmanwy and andreguilhon for your help. rainmanwy is correct, it turn out to be keyword conflict, adding library name before keyword works, i.e. SeleniumLibrary.input text xpath=//input[@name='userid'] testuser

aedahh avatar May 24 '19 16:05 aedahh