-1

very stuck in this puzzle:

The source page is: https://obstaclecourse.tricentis.com/Obstacles/41040

what I tried so far is:

*** Settings ***
Library    Browser
#Library    String
# title = CLICK ME IF YOU CAN

*** Variables ***

*** Test Cases ***
Example Test 70310
    OPEN BROWSER  https://obstaclecourse.tricentis.com/Obstacles/41040
    #${txt}=    GET TEXT    //span[contains(text(),'Table contains')]
    #CLICK    //*[contains(text(),'Click me if you can')][1]
    #
    #CLICK        //*[contains(text(),'Click me if you can')][1]  delay=100ms     clickCount=2
    #CLICK    id=buttonclick
    CLICK       xpath=//input[@id='buttontoclick']      clickCount=2
    MOUSE BUTTON    left    
    #//div[@id='']//div[@id='']
    #//div[@id='']//*[contains(text(),'Click me if you can')]
    Get Text         xpath=//body    *=   You solved this automation problem.
    # used resources  (usefull)  https://forum.katalon.com/t/two-objects-have-same-xpath/8713

FlurFunk has a solution with Tosca which can be found here: https://www.youtube.com/watch?v=cdNRfvp_qHU

I haven't found a solution with RBFW and am a bit irritated of all the tries. The code issue here is: how can I find the unique element?

LTL
  • 339
  • 1
  • 9
  • Well, the locator is `//input[@value='Click me if you can']` - but that won't be sufficient to solve it - the js moves the element on mouse over, and that's what the normal click() does. – Todor Minakov Sep 29 '21 at 13:40
  • exactly. so we need another way. It can be done in Tosca, I'm sure it can be done by RBFW as well, question is 'how'? – LTL Sep 29 '21 at 14:01

1 Answers1

1

GOT IT!!! finally

 ${ele}    Get WebElement    //input[@id='buttontoclick']
    Execute Javascript    arguments[0].click();     ARGUMENTS    ${ele} 
    ELEMENT TEXT SHOULD BE    xpath=//body    You solved this automation problem.
   

    # (notice the last comment on the following page: )
    # used resources  https://stackoverflow.com/questions/48181988/robot-framework-click-element-using-execute-javascript
    # used resources  https://www.youtube.com/watch?v=1isRH9E9WAE  ;)
LTL
  • 339
  • 1
  • 9
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 29 '21 at 16:59
  • A javascript `click()` is not exactly something a regular user will do, there's another solution that is closer to a normal usage pattern _(heck, Regular Joe has no clue there's a console, or what js is, or what for targeting an externally found DOM object)_. Remember, the automation should mimic the manual flow, what the user is expected to be doing by hand. – Todor Minakov Sep 30 '21 at 04:19