Robot Framework - executing multiple keywords after starting the if keyword

I am trying to execute a few keywords if the condition evaluates to true.

I tried to do something like this

 *** Test Cases ***
| Example

 *** Keywords ***
| Example
|  | ${title}=  Get Title
|  | Run Keyword If      | '${title}' == 'Some Title' 
|  | ... Click Element   |  xpath=some element 
|  | ... Element Text Should Be  |   xpath=some element   |  some text
|  | ... Else
|  | ... Click Element   | xpath=other element  

The error that I get on startup is that the Click Element expects 1 argument, but gets 4.

I know that I can set the if statement in the Tested Cases section, and if it is true, it will start the keyword with all the things I want, but I wonder if there is a way to do this from the Keywords section.

Thank.

+4
source share
2 answers

. , , Run keyword if. , .

- Run keyword if Run keywords, :

| | Run Keyword if | '${title}' == 'Some Title'
| | ... | Run Keywords
| | ... | Click Element | xpath=some element
| | ... | AND | Element Text Should Be  |  xpath=some element | some text
| | ... | ELSE
| | ... | Click Element | xpath=other element
+6

All Articles