# Custom Python keyword equivalent to Robot Framework's Run Keyword And Continue On Failure

**URL:** <https://forum.robotframework.org/t/custom-python-keyword-equivalent-to-robot-frameworks-run-keyword-and-continue-on-failure/8703>\
**Category:** Robot Framework\
**Created:** [24 March 2025 06:21 UTC](https://forum.robotframework.org/t/custom-python-keyword-equivalent-to-robot-frameworks-run-keyword-and-continue-on-failure/8703 "2025-03-24T06:21:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![RangeOfGlitching](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/rangeofglitching/32/4689_2.png) [@RangeOfGlitching](https://forum.robotframework.org/u/RangeOfGlitching)\
**Post date:** [24 March 2025 06:21 UTC](https://forum.robotframework.org/t/custom-python-keyword-equivalent-to-robot-frameworks-run-keyword-and-continue-on-failure/8703/1 "2025-03-24T06:21:15Z")

</div>

I know the keyword `Run Keyword And Continue On Failure` highlights failed keywords in red while allowing the process to continue, but it’s quite annoying that the report explicitly shows `Run Keyword And Continue On Failure`:

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/c/c5b7ef510f8d8980dbe48655d742c7adab667380.png)

I’m wondering if it’s possible to achieve the same effect in a \*\*custom Python keyword

1. Highlight the failed keyword in **red** within the report, but continue execution.
2. Expand the failed keyword section by default.

I’ve already referenced this [github issues](https://github.com/robotframework/robotframework/issues/3395), I understand `built_in.run_keyword_and_continue_on_failure` won’t work

Any ideas or suggestions on how to implement this?

---

<div class="post-metadata">

**Author:** ![FrancisG](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/francisg/32/4247_2.png) [@FrancisG](https://forum.robotframework.org/u/FrancisG)\
**Post date:** [24 March 2025 07:16 UTC](https://forum.robotframework.org/t/custom-python-keyword-equivalent-to-robot-frameworks-run-keyword-and-continue-on-failure/8703/2 "2025-03-24T07:16:05Z")

</div>

Have you considered using [TRY/EXCEPT feature](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#try-except-syntax)? It has more flexibility than Run Keyword And Continue On Failure and the code colour you are looking for.

Alternatively, you could use the built-in tag [robot:continue-on-failure](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#enabling-continue-on-failure-using-tags), that will keep running the test/keyword even if a step failed. Though this would be for the whole test/keyword, not for a single step.

---

<div class="post-metadata">

**Author:** ![daniel](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/daniel/32/1492_2.png) [@daniel](https://forum.robotframework.org/u/daniel)\
**Post date:** [24 March 2025 07:27 UTC](https://forum.robotframework.org/t/custom-python-keyword-equivalent-to-robot-frameworks-run-keyword-and-continue-on-failure/8703/3 "2025-03-24T07:27:29Z")

</div>

see also here [Robot Framework User Guide](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#continuable-failures)

---

<div class="post-metadata">

**Author:** ![RangeOfGlitching](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/rangeofglitching/32/4689_2.png) [@RangeOfGlitching](https://forum.robotframework.org/u/RangeOfGlitching)\
**Post date:** [24 March 2025 08:01 UTC](https://forum.robotframework.org/t/custom-python-keyword-equivalent-to-robot-frameworks-run-keyword-and-continue-on-failure/8703/4 "2025-03-24T08:01:53Z")

</div>

Appreicate ur prompt reply

my enve is  
Robot Framework 6.0.2 (Python 3.10.12 on linux)

The key point is that I need the test case to be marked as **Failed** , seems like `try-except` block can’t do it :

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/e/e169d38d1eb9c02f1c9c76cb241047b898b9ca3f.png)

Sorry, I forgot to mention this earlier.

Actually, your suggestion of using the `robot:continue-on-failure` tag solves part of my problem, but as you mentioned, this applies to the entire test rather than a specific keyword.

---

<div class="post-metadata">

**Author:** ![RangeOfGlitching](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/rangeofglitching/32/4689_2.png) [@RangeOfGlitching](https://forum.robotframework.org/u/RangeOfGlitching)\
**Post date:** [24 March 2025 08:18 UTC](https://forum.robotframework.org/t/custom-python-keyword-equivalent-to-robot-frameworks-run-keyword-and-continue-on-failure/8703/5 "2025-03-24T08:18:04Z")

</div>

This is EXACTLY what I was looking for!  
Thanks dude!!! 🚀
