首页 > 解决方案 > How to use 'Exit For Loop IF' keyword with multiple condition in Selenium Robot framework

问题描述

I need to exit FOR LOOP in Selenium Robot framework when multiple conditions are met

I am trying something like this where it should exit FOR LOOP , if the below conditions are met:

Exit For Loop IF    '${Name}'=='Adam'   and '${Age}'=='27'

Error:

Keyword 'BuiltIn.Exit For Loop If' expected 1 argument, got 2.

标签: seleniumfor-loopif-statementrobotframeworkbuilt-in

解决方案


You need to be careful that Robot Framework use space separated format.
I.e. Robot Framework will separate the and operator as a new argument since there is more than 2 spaces between the conditions.
That's why Robot Framework think you give two arguments instead of one and the execution will fail.

Please try make it one space.

Exit For Loop If    '${Name}'=='Adam' and '${Age}'=='27'

推荐阅读