I am writing some basic automated tests and I find myself repeating the same two keywords over and over again, I wondered if there was a simpler way.
Since they both use the same variable I would like to create another keyword so that when I call it for use in other keywords I can just write one line.
What I have:
Click Home Button
Wait Until Element Is Visible ${HOME_BUTTON}
Click Button ${HOME_BUTTON}
What I would like to have:
Click Home Button
Wait Until Visible And Click ${HOME_BUTTON}
I would like to know how to write the new keyword
Wait Until Visible And Click
You could do it this way:
***Variables***
${HOME_BUTTON} myVar
***Keywords***
Wait Until Visible And Click
[Arguments] ${myvar}
Wait Until Element Is Visible ${myvar}
Click Button ${myvar}
***Test cases***
My Testcase1
Wait Until Visible And Click ${myvar1}
My Testcase2
Wait Until Visible And Click ${myvar1}