In Robotframework, the 'Click Button' keyword do clicks the button, but when it comes to check that the button doesn't exist anymore and it's clicked, sometimes additional check ( like Page Should Not Contain or Element Should Not Be Visible ) Is fails or the script can't find the button to click it.
What I have tried:
- For loop to click button- Code below
- Wait Until Keyword - Code below
- Click element using Javascript
Issue is intermittant fails 1 of 5 times.How can I deal with this Problem?
//Code Samples 2 different ways to click the button
1.
Wait Until Page Contains Element ${BTN_BET} 60s
Double Click Element ${BTN_BET}
FOR ${INDEX} IN RANGE 100
${CHECK}= Run Keyword And Return Status Page Should Contain Element ${BTN_BET}
Run Keyword If '${CHECK}' == "True" Double Click Element ${BTN_BET}
Run Keyword If '${CHECK}' == "False" Exit For Loop
END
Page Should Contain
... You clicked the button
2.
Wait Until Keyword Succeeds 60s 0.5s Page Should Contain Element ${BTN_BET}
Sleep 2s
Wait Until Keyword Succeeds 30s 0.5s Execute JavaScript document.evaluate
('${BTN_BET}',document.body,null,9,null).singleNodeValue.click()
Sleep 5s
Wait Until Page Contains Element //div[@class='results-warning' and .='Wait
for another stage'] 40s
Page Should Contain
... You clicked the button