How to Skip remeing test case and move to next test case if the element is disabled

I want to move the execution to next test case if the element is disabled it should log the whether the element is enabled or disable If it is enabled then continue with the test case (remaining code)and if it is disabled then move to next test case skip the remaining code in test case
for example:

    TC01
        Element Should Be Enabled  ${options}#if not skip the remaing code and go to next test case
        Click Element  ${abc}
    TC02
         Element Should Be Enabled  ${options}#if enabled continue with the remaing code
        Click Element  ${abc}

How can I do this in robot framework? can we skip the reaming part of test case if any condition in test case not satisfied??

${present} Run Keyword And Return Status Element Should Be Enabled ${options}
IF ${present}
Click Element ${abc}
ELSE
TC02

@NikosKoul Thanks for the Answer. How to Log if the option is disabled and can we use skip if keyword?
the operations if the element is enabled is of more than 80 lines what will be the best way to get expected results(code should also look good)?

Could you please explain it better? I hardly understand what you want to do there… Maybe you want smth like this?

# Skip tests If ${options} is disabled
${present} Run Keyword And Return Status Element Should Be Enabled ${options}
IF  ${present}
   Click Element  ${abc}
ELSE
   Skip  msg=The ${options} is disabled
1 Like

@NikosKoul I got the answer with the above solution
I just wanted to know Is there any other better way to do this
For ex. I have multiple test cases and I want to verify if the option is enabled continue with the test case (there will e lots of coding done on the option if enabled) and skip if the option is disabled

# Skip tests If ${options} is disabled
${present} Run Keyword And Return Status Element Should Be Enabled ${options}
IF  ${present}
   Click Element  ${abc}
#more than 80 lines of code
ELSE
   Skip  msg=The ${options} is disabled

So is there any other best way to look code more better and instead of IF condition which have more than 80 lines of code and then do Else I’m just curious to know if there any other way

TIA

1 Like

Take a look here.
https://stackoverflow.com/questions/25075706/automatic-failing-non-execution-of-interdependent-tests-in-robot-framework/25079032#25079032

Another way is by setting the ${present} variable into a global/suite variable and using this as the IF argument with tags. What I mean is:

Skip tests If ${options} is disabled

${present} Run Keyword And Return Status Element Should Be Enabled ${options}
Set Global Variable ${PRESENT_ARG} ${present}

So in the test setup you could call a function where the ${PRESENT_ARG} is True.