Reputation: 147
I've tried this to increment the variable after, but it didn't work
Run Keyword If '${state}'=='True' Run Keywords Click Element
xpath=//button[@overflow]
... AND Click Element css=#stack
... ${i} Set Variable 1
... AND FOR ${item} IN ${items}
Log ${item}
Log ${i}
${i} Set Variable ${i} + 1
END
Upvotes: 0
Views: 638
Reputation: 7271
You should remove the Run Keywords
and replace it with a user keyword in which you can use FOR
loop and you could increment your variable like ${i} Evaluate ${i}+1
.
You could also return ${i}
or anything else and use its value in the test later on.
*** Test Cases ***
Test
${i}= Run Keyword If 'True'=='True' My logic
Log ${i}
*** Keyword ***
My Logic
Log xpath=//button[@overflow]
Log css=#stack
${i} Set Variable 1
FOR ${item} IN item1 item2
Log ${item}
Log ${i}
${i} Evaluate ${i}+1
END
[Return] ${i}
Upvotes: 1