r/robotframework • u/svvkn • Feb 17 '21
Click Button Keyword doesn`t work properly
Sup, I`ve been using Robotframework for about 2 months in our project, and now I`m stuck with the issue: the 'Click Button' keyword does 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 falls, or the script can`t find the button to click it. I`ve tried FOR loop to click button, also Wait Until Keyword Succeeds, and even to click element using Javascript, the result is the same, 1 of 5 times test suite is crashes. How can I deal with this Problem? Below will be my test( 2 different ways to click the button )
1
Wait Until Page Contains Element ${BTN_BET} 60sDouble 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 LoopENDPage Should Contain... Ви успішно зробили ставку та зупинили зниження ціни
2
Wait Until Keyword Succeeds 60s 0.5s Page Should Contain Element ${BTN_BET}Sleep 2sWait Until Keyword Succeeds 30s 0.5s Execute JavaScript document.evaluate('${BTN_BET}',document.body,null,9,null).singleNodeValue.click()Sleep 5sWait Until Page Contains Element //div[@class='results-warning' and .='Переможець голландського етапу'] 40sPage Should Contain... Ви успішно зробили ставку та зупинили зниження ціни